{"id":13586440,"url":"https://github.com/isaacbernat/netflix-to-srt","last_synced_at":"2026-04-02T23:55:30.990Z","repository":{"id":44709502,"uuid":"41666404","full_name":"isaacbernat/netflix-to-srt","owner":"isaacbernat","description":"Rip, extract and convert subtitles to .srt closed captions from .xml/dfxp/ttml and .vtt/WebVTT (e.g. Netflix, YouTube)","archived":false,"fork":false,"pushed_at":"2024-09-27T20:12:07.000Z","size":259,"stargazers_count":749,"open_issues_count":5,"forks_count":72,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-10-13T09:24:21.710Z","etag":null,"topics":["closed-captioning","closed-captions","dfxp","hacktoberfest","netflix","python","python3","regex","srt","subrip","subtitle","subtitles","vtt","vtt-to-srt","webvtt","youtube","youtube-dl"],"latest_commit_sha":null,"homepage":"","language":"Python","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/isaacbernat.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-31T09:07:46.000Z","updated_at":"2024-09-29T00:09:47.000Z","dependencies_parsed_at":"2024-10-25T18:31:23.463Z","dependency_job_id":"b4f299a9-09c0-49ee-84f5-b7fbb5fc157b","html_url":"https://github.com/isaacbernat/netflix-to-srt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacbernat%2Fnetflix-to-srt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacbernat%2Fnetflix-to-srt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacbernat%2Fnetflix-to-srt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacbernat%2Fnetflix-to-srt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaacbernat","download_url":"https://codeload.github.com/isaacbernat/netflix-to-srt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"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":["closed-captioning","closed-captions","dfxp","hacktoberfest","netflix","python","python3","regex","srt","subrip","subtitle","subtitles","vtt","vtt-to-srt","webvtt","youtube","youtube-dl"],"created_at":"2024-08-01T15:05:34.358Z","updated_at":"2026-04-02T23:55:30.978Z","avatar_url":"https://github.com/isaacbernat.png","language":"Python","funding_links":[],"categories":["Python","JavaScript","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# How to get `.srt` subtitles from streaming services\n\u003cdiv align=\"center\"\u003e\n\n\u003ckbd\u003e \u003cbr\u003e [Click here to convert your subs][Link] \u003cbr\u003e \u003c/kbd\u003e\n\nOr follow the instructions below:\n\u003c/div\u003e\n\n1. [Get the subtitles](https://github.com/isaacbernat/netflix-to-srt#get-the-subtitles) (`.xml` dfxp or `.vtt` files from Netflix, YouTube... streaming media services).\n    - [From Netflix](https://github.com/isaacbernat/netflix-to-srt#from-netflix).\n    - [From YouTube](https://github.com/isaacbernat/netflix-to-srt#from-youtube).\n2. [Convert them](https://github.com/isaacbernat/netflix-to-srt#convert-them-into-srt) into `.srt` files (and/or shift timestamps).\n    - [Using your web browser](https://github.com/isaacbernat/netflix-to-srt#using-your-web-browser) (easiest).\n    - [Using Python](https://github.com/isaacbernat/netflix-to-srt#using-python) (better for big batches and automation).\n3. [Star this repo ⭐](https://github.com/isaacbernat/netflix-to-srt#star-this-repo).\n\n## Get the subtitles\n### From Netflix\n \u003e **Note:** There is a [video-tutorial covering all instructions step-by-step in Youtube on how to to download and convert subtitles from Netflix](https://www.youtube.com/watch?v=ZpejTczG8Ho) using Windows and Google Chrome.[![YouTube link to the tutorial](https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/images/tutorial.png \"YouTube link to the tutorial\")](https://www.youtube.com/watch?v=ZpejTczG8Ho)\n\n### Get subtitles from Netflix: method 1\n1. You need one of the following web browsers:\n   - [Google Chrome](https://www.google.com/chrome/browser/desktop/)\n   - Firefox\n   - Safari\n   - Microsoft Edge\n   - Opera\n2. Install [Tampermonkey](https://www.tampermonkey.net/), links below:\n   - [Chrome extension](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)\n   - [Firefox addon](https://addons.mozilla.org/firefox/addon/tampermonkey/)\n   - [Safari howto](https://www.tampermonkey.net/?browser=safari)\n   - [Microsoft Edge addon](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd)\n   - [Opera addon](https://addons.opera.com/extensions/details/tampermonkey-beta/)\n3. Install [Netflix - subtitle downloader](https://greasyfork.org/en/scripts/26654-netflix-subtitle-downloader) script for Tampermonkey.\n4. To download the subtitles file from Netflix, open the episode in Netflix and download them by clicking on _\"Download subs from this episode\"_ (see image below). ![Screenshot of \"Download subs\" option](https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/images/netflix-tampermonkey-download-subs.png \"Screenshot of 'Download subs' option\")\n\n### Get subtitles from Netflix: method 2\nYou need [Google Chrome](https://www.google.com/chrome/browser/desktop/). *not tested on other web browsers*\n\n1. Open devtools. This is usually accomplished by either:\n    - Pressing `Cmd` + `Alt` + `i`.\n    - Pressing `F12`.\n2. Go to Network tab within dev tools.\n3. Load your movie/episode.\n4. Select the subtitle you want.\n5. In devtools sort by name and look for a file with `?o=` at the beginning of the name (see image below).\n\n![Screenshot of Dev tools download](https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/images/netflix-devtools-download-subs.png \"Screenshot of Dev tools download\")\n\n### Get subtitles from Netflix: method 3\nThe information is extracted from [this post](http://forum.opensubtitles.org/viewtopic.php?t=15141).\n\nYou need FireFox and AdblockPlus Add-On. *not tested on other browsers*\n- Start Netflix and your movie/episode (stream is active!)\n- Start AdblockPlus, open blockable items\n- Search: dfxp *(e.g. `\u003e\u003e #.nflximg.com/#/#/########.dfxp?v=1\u0026e=#########\u0026t=######_#####\u0026random=1234567890`)*\n- open the dfxp in a new window\n- Save as\n\n### From YouTube\n\u003e **Note:** One must ensure subtitles in the YouTube video (captions) are enabled before running commands below. \n### Get subtitles from YouTube: method 1\n- Install [youtube-dl](https://github.com/ytdl-org/youtube-dl) (available for Windows, Mac and Linux).\n- Download subs from the YouTube URL you like. E.g. `youtube-dl --all-subs \"https://www.youtube.com/watch?v=VHNfvFOBC0A\"`\n- Subtitles should be downloaded in the same folder were the command was ran. E.g. `NameOfTheVideo VHNfvFOBC0A.ca.vtt, NameOfTheVideo VHNfvFOBC0A.tlh.vtt`\n- If you are missing a language, check that it's actually available. E.g. `youtube-dl --list-subs \"https://www.youtube.com/watch?v=VHNfvFOBC0A\"`\n\n### Get subtitles from YouTube: method 2\n- Install [youtube-dlp](https://github.com/yt-dlp/yt-dlp-wiki/blob/master/Installation.md) (available for Windows, Mac and Linux). It's a fork version of youtube-dl by [Snap](https://snapcraft.io/yt-dlp).\n- Download subs from the YouTube URL you like. E.g. `yt-dlp --skip-download --write-auto-subs --sub-lang \"en\" \"https://youtu.be/cVsyJvxX48A\"` \n- The above command will download YouTube subtitles in VTT format. *Alternatively*, one may use it's own integrated converter to get them in `srt` format right away. E.g. `yt-dlp --skip-download --write-auto-subs --convert-subs srt --sub-lang \"en\" \"https://youtu.be/cVsyJvxX48A`\n- To download the video with audio and subtitles, simply omit the --skip-download option. E.g. `yt-dlp --write-auto-subs --sub-lang \"en\" \"https://youtu.be/cVsyJvxX48A\"`\n\n## Convert them into .srt\n### Using your web browser\n- Go to [netflix-to-srt.pages.dev](https://netflix-to-srt.pages.dev) (or alternatively [isaacbernat.github.io/netflix-to-srt-web](https://isaacbernat.github.io/netflix-to-srt-web)).\n- Upload the subtitles and click \"convert\".\n- Enjoy! (And **star the repo ⭐** if you liked it ;D).\n\n### Using Python\n- [Get python](https://www.python.org/downloads/) (*If you have mac or linux you may skip this step*).\n- Clone this repository or [download it as a ZIP file](https://github.com/isaacbernat/netflix-to-srt/archive/refs/heads/master.zip) or [download `to_srt.py` file](https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/to_srt.py) .\n- Run the script in the terminal (type `python to_srt.py` or `python3 to_srt.py` from the terminal on the folder you have `to_srt.py`).\n  - Copy your subtitle files in the same directory as `to_srt.py`.\n    - Or use `-i INPUT_PATH` and `-o OUTPUT_PATH` for custom file locations.\n  - All `.xml` and `.vtt` files in the input directory will generate a converted `.srt` file on the output one.\n- *Optional:* Use `-d DELAY_MS` parameter when running the script to delay all the timestamps by the given number of milliseconds. Negative values shift timestamps backwards. Example: `python to_srt.py -i samples/delays -o samples/delays -d -1500` will take all the eligible files in `samples/delays` and shift the resulting `.srt` subtitles to be 1.5 seconds earlier than the original version.\n- Enjoy! (And **star the repo ⭐** if you liked it ;D).\n- *Note:* Tested on Python 3.10+ and newer (3.10 is [the oldest still supported](https://devguide.python.org/versions/)). Previous versions were compatible with Python 2.7 but it's not supported anymore. \n\n## Star this repo\nIf you like this project, please **star the repository ⭐**. It's free and it helps get visibility and future improvements.\n- You may skip the following step if you are already logged in Github.\n  - [Sign in](https://github.com/login) if you have an account.\n  - [Sign up](https://github.com/signup?source=login) if you don't have an account (it's free!).\n- Scroll to the top of this page or [open it in a new tab/window](https://github.com/isaacbernat/netflix-to-srt) and check the for a star icon (it's near the screen laterals)\n  - If the star icon is already yellow ⭐, congrats! It's already starred! You don't need to do anything else.\n  - If the star icon is empty ☆, you may click on it once, and it'll become yellow ⭐!\n  ![Wide screenshot of the star icon](https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/images/star_screenshot_desktop.png \"Wide screenshot of the star icon\")\n  ![Thin screenshot of the star icon](https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/images/star_screenshot_mobile.png \"Thin screenshot of the star icon\")\n- Thanks for your contribution!\n\n\u003cpicture\u003e\n  \u003cimg\n    alt=\"Star History Chart\"\n    src=\"https://raw.githubusercontent.com/isaacbernat/netflix-to-srt/master/images/star-history-2026330.png\"\n  /\u003e\n\u003c/picture\u003e\n\n\n## Why this repository?\n[VideoLAN's VLC media player](https://www.videolan.org/vlc/) could not reproduce that kind of xml subtitles and I could not find any tool that could easily transform the xml files to a suitable format (e.g. SubRip (`.srt`)) in Linux or Mac, so I wrote this script and decided to share. I got a request for WebVTT (`.vtt`) and did the same. Other features like font colors and styles are partially supported. Feel free to [create an Issue](https://github.com/isaacbernat/netflix-to-srt/issues) or Pull Request with improvement ideas.\n\nSimilarly, adjusting timestamps in 50ms increments was inconvenient using VLC's hotkeys (G, H and/or J) for large mismatches (e.g. 60 seconds because openings or summaries), so I added the `-d DELAY_MS` parameter so I could \"advance\" all the subtitles lines easily.\n\nRequiring access to a terminal with Python installed was a limiting factor for many users. I added the javascript version so it may be run on any web browser. The JavaScript version is an isomorphic port optimized for zero-dependency execution in both browsers and Node.js environments.\n\n## Testing\n### Python tests\nRun the Python test suite with verbose output (use `python3` instead of `python` depending on your OS alias):\n```bash\npython -m unittest discover -s tests -v\n```\n\n### Node.js tests\nRun the JavaScript test suite (tests the web version in `web/script.js`):\n```bash\nnode --test tests/test_to_srt.js\n```\n\n## Note\nIn no way I am encouraging any kind of illegal activity. Please know your local laws and ask for written permissions from content owners (e.g. Netflix, YouTube) when necessary.\n\n## Contributing\nContributions are welcome. Feel free to create a Pull Request. Your help will make this project even better for everyone.\n\n[Link]: https://netflix-to-srt.pages.dev/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaacbernat%2Fnetflix-to-srt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaacbernat%2Fnetflix-to-srt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaacbernat%2Fnetflix-to-srt/lists"}