{"id":17050477,"url":"https://github.com/eush77/ass-parser","last_synced_at":"2025-04-12T15:43:49.498Z","repository":{"id":26095365,"uuid":"29539439","full_name":"eush77/ass-parser","owner":"eush77","description":"Parse SSA/ASS subtitle format","archived":false,"fork":false,"pushed_at":"2018-01-08T21:14:01.000Z","size":15,"stargazers_count":14,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T10:11:30.529Z","etag":null,"topics":["ass","parser","ssa","subtitles","syntax"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eush77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-20T16:31:12.000Z","updated_at":"2025-02-22T18:19:01.000Z","dependencies_parsed_at":"2022-09-02T23:21:18.165Z","dependency_job_id":null,"html_url":"https://github.com/eush77/ass-parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eush77%2Fass-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eush77%2Fass-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eush77%2Fass-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eush77%2Fass-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eush77","download_url":"https://codeload.github.com/eush77/ass-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208603,"owners_count":21065203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ass","parser","ssa","subtitles","syntax"],"created_at":"2024-10-14T09:56:57.629Z","updated_at":"2025-04-12T15:43:49.479Z","avatar_url":"https://github.com/eush77.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://nodei.co/npm/ass-parser.png)](https://nodei.co/npm/ass-parser/)\n\n# ass-parser\n\n[![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david]\n\nParse SSA/ASS subtitle format.\n\n[travis]: https://travis-ci.org/eush77/ass-parser\n[travis-badge]: https://travis-ci.org/eush77/ass-parser.svg\n[david]: https://david-dm.org/eush77/ass-parser\n[david-badge]: https://david-dm.org/eush77/ass-parser.png\n\n## Example\n\nFor the ASS subtitle below (from the [Wikipedia page](http://en.wikipedia.org/wiki/SubStation_Alpha))\n\n```\n[Script Info]\n; This is a Sub Station Alpha v4 script.\n; For Sub Station Alpha info and downloads,\n; go to http://www.eswat.demon.co.uk/\nTitle: Neon Genesis Evangelion - Episode 26 (neutral Spanish)\nOriginal Script: RoRo\nScript Updated By: version 2.8.01\nScriptType: v4.00\nCollisions: Normal\nPlayResY: 600\nPlayDepth: 0\nTimer: 100,0000\n\n[V4 Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding\nStyle: DefaultVCD, Arial,28,11861244,11861244,11861244,-2147483640,-1,0,1,1,2,2,30,30,30,0,0\n\n[Events]\nFormat: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\nDialogue: Marked=0,0:00:01.18,0:00:06.85,DefaultVCD, NTP,0000,0000,0000,,{\\pos(400,570)}Like an angel with pity on nobody\n\n```\n\n`assParser(text, { comments: true })` returns the following:\n\n```js\n[\n    {\n        \"section\": \"Script Info\",\n        \"body\": [\n            {\n                \"type\": \"comment\",\n                \"value\": \" This is a Sub Station Alpha v4 script.\"\n            },\n            {\n                \"type\": \"comment\",\n                \"value\": \" For Sub Station Alpha info and downloads,\"\n            },\n            {\n                \"type\": \"comment\",\n                \"value\": \" go to http://www.eswat.demon.co.uk/\"\n            },\n            {\n                \"key\": \"Title\",\n                \"value\": \"Neon Genesis Evangelion - Episode 26 (neutral Spanish)\"\n            },\n            {\n                \"key\": \"Original Script\",\n                \"value\": \"RoRo\"\n            },\n            {\n                \"key\": \"Script Updated By\",\n                \"value\": \"version 2.8.01\"\n            },\n            {\n                \"key\": \"ScriptType\",\n                \"value\": \"v4.00\"\n            },\n            {\n                \"key\": \"Collisions\",\n                \"value\": \"Normal\"\n            },\n            {\n                \"key\": \"PlayResY\",\n                \"value\": \"600\"\n            },\n            {\n                \"key\": \"PlayDepth\",\n                \"value\": \"0\"\n            },\n            {\n                \"key\": \"Timer\",\n                \"value\": \"100,0000\"\n            }\n        ]\n    },\n    {\n        \"section\": \"V4 Styles\",\n        \"body\": [\n            {\n                \"key\": \"Format\",\n                \"value\": [\n                    \"Name\",\n                    \"Fontname\",\n                    \"Fontsize\",\n                    \"PrimaryColour\",\n                    \"SecondaryColour\",\n                    \"TertiaryColour\",\n                    \"BackColour\",\n                    \"Bold\",\n                    \"Italic\",\n                    \"BorderStyle\",\n                    \"Outline\",\n                    \"Shadow\",\n                    \"Alignment\",\n                    \"MarginL\",\n                    \"MarginR\",\n                    \"MarginV\",\n                    \"AlphaLevel\",\n                    \"Encoding\"\n                ]\n            },\n            {\n                \"key\": \"Style\",\n                \"value\": {\n                    \"Name\": \"DefaultVCD\",\n                    \"Fontname\": \"Arial\",\n                    \"Fontsize\": \"28\",\n                    \"PrimaryColour\": \"11861244\",\n                    \"SecondaryColour\": \"11861244\",\n                    \"TertiaryColour\": \"11861244\",\n                    \"BackColour\": \"-2147483640\",\n                    \"Bold\": \"-1\",\n                    \"Italic\": \"0\",\n                    \"BorderStyle\": \"1\",\n                    \"Outline\": \"1\",\n                    \"Shadow\": \"2\",\n                    \"Alignment\": \"2\",\n                    \"MarginL\": \"30\",\n                    \"MarginR\": \"30\",\n                    \"MarginV\": \"30\",\n                    \"AlphaLevel\": \"0\",\n                    \"Encoding\": \"0\"\n                }\n            }\n        ]\n    },\n    {\n        \"section\": \"Events\",\n        \"body\": [\n            {\n                \"key\": \"Format\",\n                \"value\": [\n                    \"Marked\",\n                    \"Start\",\n                    \"End\",\n                    \"Style\",\n                    \"Name\",\n                    \"MarginL\",\n                    \"MarginR\",\n                    \"MarginV\",\n                    \"Effect\",\n                    \"Text\"\n                ]\n            },\n            {\n                \"key\": \"Dialogue\",\n                \"value\": {\n                    \"Marked\": \"Marked=0\",\n                    \"Start\": \"0:00:01.18\",\n                    \"End\": \"0:00:06.85\",\n                    \"Style\": \"DefaultVCD\",\n                    \"Name\": \"NTP\",\n                    \"MarginL\": \"0000\",\n                    \"MarginR\": \"0000\",\n                    \"MarginV\": \"0000\",\n                    \"Effect\": \"\",\n                    \"Text\": \"{\\\\pos(400,570)}Like an angel with pity on nobody\"\n                }\n            }\n        ]\n    }\n]\n```\n\n## API\n\n### `assParser(text, [options])`\n\nReturns the parse tree.\n\nComments are ignored unless `options.comments` is set.\n\n| Option   | Type    | Required? | Default |\n| :------- | :------ | :-------: | :------ |\n| comments | boolean | No        | `false` |\n\n## Format\n\nSubtitle is a list of sections, each of them has `section` and `body` properties. The `body` is a list of key-value bindings (descriptors), with `key` and `value` properties (`type == 'comment'` and `value` for comments).\n\n`value` can be one of the following:\n- array if the descriptor key is `\"Format\"`;\n- object if there is a `\"Format\"` descriptor above in the section;\n- string otherwise.\n\n## References\n\n- [Wikipedia page](http://en.wikipedia.org/wiki/SubStation_Alpha)\n- [format specification](http://www.perlfu.co.uk/projects/asa/ass-specs.doc)\n\n## Related\n\n- [ass-stringify](https://www.npmjs.com/packages/ass-stringify) - stringify SSA/ASS parse tree.\n\n## Install\n\n```shell\nnpm install ass-parser\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feush77%2Fass-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feush77%2Fass-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feush77%2Fass-parser/lists"}