{"id":33933777,"url":"https://github.com/mochi-neko/subtp","last_synced_at":"2026-04-08T13:31:27.331Z","repository":{"id":221796829,"uuid":"752133148","full_name":"mochi-neko/subtp","owner":"mochi-neko","description":"A parser for subtitle text formats (SubRip Subtitle and WebVTT) in Rust.","archived":false,"fork":false,"pushed_at":"2024-02-20T08:19:21.000Z","size":121,"stargazers_count":4,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-09T05:18:30.065Z","etag":null,"topics":["parser","rust","subrip","webvtt"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mochi-neko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-03T05:47:08.000Z","updated_at":"2024-11-25T05:35:31.000Z","dependencies_parsed_at":"2024-02-19T12:41:58.914Z","dependency_job_id":"97797cdc-fe7b-4608-80f5-061393a8ea04","html_url":"https://github.com/mochi-neko/subtp","commit_stats":null,"previous_names":["mochi-neko/subtp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mochi-neko/subtp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochi-neko%2Fsubtp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochi-neko%2Fsubtp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochi-neko%2Fsubtp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochi-neko%2Fsubtp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mochi-neko","download_url":"https://codeload.github.com/mochi-neko/subtp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochi-neko%2Fsubtp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31558380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parser","rust","subrip","webvtt"],"created_at":"2025-12-12T13:12:08.983Z","updated_at":"2026-04-08T13:31:27.309Z","avatar_url":"https://github.com/mochi-neko.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# subtp\nA parser in Rust for subtitle text formats such as the SubRip Subtitle (.srt) format and the WebVTT (.vtt) format.\n\n## Installation\n\nRun the following Cargo command in your project directory:\n\n```shell\ncargo add subtp\n```\n\nor add the following line to your Cargo.toml:\n\n```toml\n[dependencies]\nsubtp = \"0.2.0\"\n```\n\n## Features\n\n- [x] [SubRip Subtitle (.srt)](#subrip-subtitle-srt) parser and renderer.\n- [x] [WebVTT (.vtt)](#webvtt-vtt) parser and renderer.\n\n## Usage\n\n### SubRip Subtitle (.srt)\n\nParse a SubRip Subtitle (.srt) text into a `subtp::srt::SubRip` struct.\n\n```rust\nuse subtp::srt::SubRip;\n\nlet text = r#\"\n1\n00:00:00,000 --\u003e 00:00:02,000\nHello, world!\n\n2\n00:00:02,000 --\u003e 00:00:04,000\nThis is a subtitle.\n\"#;\n\nlet subrip = SubRip::parse(text)?;\n```\n\nRender a `subtp::srt::SubRip` struct into a SubRip Subtitle (.srt) text.\n\n`subtp::srt::SubRip` is constructed with a vector of `subtp::srt::SrtSubtitle`.\n\n```rust\nuse subtp::srt::{SubRip, SrtSubtitle, SrtTimestamp};\n\nlet subrip = SubRip {\n    subtitles: vec![\n        SrtSubtitle {\n            sequence: 1,\n            start: SrtTimestamp {\n                seconds: 1,\n                ..Default::default()\n            },\n            end: SrtTimestamp {\n                seconds: 2,\n                ..Default::default()\n            },\n            text: vec![\"This is the first subtitle.\".to_string()],\n            ..Default::default()\n        },\n        SrtSubtitle {\n            sequence: 2,\n            start: SrtTimestamp {\n                seconds: 3,\n                ..Default::default()\n            },\n            end: SrtTimestamp {\n                seconds: 4,\n                ..Default::default()\n            },\n            text: vec![\n                \"This is the second subtitle.\".to_string(),\n                \"Subtitle text can span multiple lines.\".to_string(),\n            ],\n            ..Default::default()\n        },\n    ],\n};\n \nlet text = subrip.render();\n```\n\n### WebVTT (.vtt)\n\nParse a WebVTT (.vtt) text into a `subtp::vtt::WebVTT` struct.\n\n```rust\nuse subtp::vtt::WebVtt;\n\nlet text = r#\"WEBVTT\n\n1\n00:00:00.000 --\u003e 00:00:02.000\nHello, world!\n\n2\n00:00:02.000 --\u003e 00:00:04.000\nThis is a subtitle.\n\"#;\n\nlet webvtt = WebVtt::parse(text)?;\n```\n\nRender a `subtp::vtt::WebVTT` struct into a WebVTT (.vtt) text.\n\n`subtp::vtt::WebVTT` is constructed with a header `subtp::vtt::VttHeader` and a vector of `subtp::vtt::VttBlcok`.\n\n`subtp::vtt::VttBlcok` can be following types:\n- `subtp::vtt::VttCue`\n    - Cue block with an identifier (Optional), timings, settings (Optional) and a subtitle text. \n- `subtp::vtt::VttComment`\n    - Comment block with a noting text. \n- `subtp::vtt::VttStyle`\n    - Style block with a CSS style text. \n- `subtp::vtt::VttRegion`\n    - Region block with a region definition. \n\n```rust\nuse subtp::vtt::{WebVtt, VttBlock, VttCue, VttHeader, VttTimings, VttTimestamp};\n\nlet webvtt = WebVtt {\n    blocks: vec![\n        VttCue {\n            identifier: Some(\"1\".to_string()),\n            timings: VttTimings {\n                start: VttTimestamp {\n                    seconds: 0,\n                    ..Default::default()\n                },\n                end: VttTimestamp {\n                    seconds: 2,\n                    ..Default::default()\n                },\n            },\n            payload: vec![\"Hello, world!\".to_string()],\n            ..Default::default()\n        }.into(),\n        VttCue {\n            identifier: Some(\"2\".to_string()),\n            timings: VttTimings {\n                start: VttTimestamp {\n                    seconds: 2,\n                    ..Default::default()\n                },\n                end: VttTimestamp {\n                    seconds: 4,\n                    ..Default::default()\n                },\n            },\n            payload: vec![\"This is a subtitle.\".to_string()],\n            ..Default::default()\n        }.into(),\n    ],\n    ..Default::default()\n};\n\nlet text = webvtt.render();\n```\n\n## Other examples\n\nSee the [./examples](./examples) directory.\n\n## Changelog\n\nSee [CHANGELOG](./CHANGELOG.md).\n\n## License\n\nLicensed under either of the [Apache License, Version 2.0](./LICENSE-APACHE) or the [MIT](./LICENSE-MIT) license at your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmochi-neko%2Fsubtp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmochi-neko%2Fsubtp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmochi-neko%2Fsubtp/lists"}