- Get the subtitles (
.xml
dfxp or.vtt
files from Netflix, YouTube... streaming media services). - Convert them into
.srt
files. - Star this repo ⭐
Note: There is a video-tutorial covering all instructions step-by-step in Youtube on how to to download and convert subtitles from Netflix using Windows and Google Chrome.
- You need one of the following web browsers:
- Google Chrome
- Firefox
- Safari
- Microsoft Edge
- Opera
- Install Tampermonkey, links below:
- Install Netflix - subtitle downloader script for Tampermonkey.
- 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).
You need Google Chrome. not tested on other web browsers
- Open devtools. This is usually accomplished by either:
- Pressing
Cmd
+Alt
+i
. - Pressing
F12
.
- Pressing
- Go to Network tab within dev tools.
- Load your movie/episode.
- Select the subtitle you want.
- In devtools sort by name and look for a file with
?o=
at the beginning of the name (see image below).
The information is extracted from this post.
You need FireFox and AdblockPlus Add-On. not tested on other browsers
- Start Netflix and your movie/episode (stream is active!)
- Start AdblockPlus, open blockable items
- Search: dfxp (e.g.
>> #.nflximg.com/#/#/########.dfxp?v=1&e=#########&t=######_#####&random=1234567890
) - open the dfxp in a new window
- Save as
Note: One must ensure subtitles in the YouTube video (captions) are enabled before running commands below.
- Install youtube-dl (available for Windows, Mac and Linux)
- Download subs from the YouTube URL you like. E.g.
youtube-dl --all-subs "https://www.youtube.com/watch?v=VHNfvFOBC0A"
- Subtitles should be downloaded in the same folder were the command was ran. E.g.
NameOfTheVideo VHNfvFOBC0A.ca.vtt, NameOfTheVideo VHNfvFOBC0A.tlh.vtt
- 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"
- Install youtube-dlp (available for Windows, Mac and Linux). It's a fork version of youtube-dl by Snap.
- Download subs from the YouTube URL you like. E.g.
yt-dlp --skip-download --write-auto-subs --sub-lang "en" "https://youtu.be/cVsyJvxX48A"
- 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
- 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"
- Get python (tested under python 2.7, 3.3 and newer). If you have mac or linux you may skip this step
- Clone this repository or download it as a ZIP file or download
to_srt.py
file - Run the script in the terminal (type
python to_srt.py
orpython3 to_srt.py
from the terminal on the folder you haveto_srt.py
)- Copy your subtitle files in the same directory as
to_srt.py
- Or use
-i INPUT_PATH
and-o OUTPUT_PATH
for custom file locations
- Or use
- All
.xml
and.vtt
files in the input directory will generate a converted.srt
file on the output one
- Copy your subtitle files in the same directory as
- Enjoy! (And star the repo ⭐ if you liked it ;D)
If you like this project, please star the repository ⭐. It's free and it helps get visibility and future improvements.
- You may skip the following step if you are already logged in Github.
- Scroll to the top of this page or open it in a new tab/window and check the for a star icon (it's near the screen laterals)
- Thanks for your contribution!
VLC player 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.
- More robust file parsing than just some quick and dirty regexes.
- Javascript/web version so this can be done entirely through a browser.
- Real tests. The way to "test" it now is by running
python to_srt.py -i samples -o samples
from the the project's root directory and check the.srt
results (orpython3 to_srt.py -i samples -o samples
). - Create a pip package for this.
- More screenshots so 'Get the subtitles' section is easier to follow.
In 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.
Contributions are always welcome! Feel free to create a Pull Request and add screenshots for each step/method that works best for you. Your help will make this project even better for everyone.