Skip to content

About

scrape subtitles from opensubtitles.org

Topics

Resources

Stars

57 stars

Watchers

5 watching

Forks

Latest commit

 

History

504 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opensubtitles-scraper

scrape subtitles from opensubtitles.org

result

torrent RSS feed: opensubtitles.org.dump.torrent.rss

unreleased subs are stored in github.com/milahu/opensubtitles-scraper-new-subs

usage

run get-subs.py to get subtitles for a movie:

~/src/opensubtitles-scraper/get-subs.py Scary.Movie.2000.mp4

video_path Scary.Movie.2000.mp4
video_filename Scary.Movie.2000.mp4
video_parsed MatchesDict([('title', 'Scary Movie'), ('year', 2000), ('container', 'mp4'), ('mimetype', 'video/mp4'), ('type', 'movie')])
output 'Scary.Movie.2000.en.00018286.sub' from 'Scary_eng.txt' (us-ascii)
output 'Scary.Movie.2000.en.00018615.sub' from 'Scary Movie.txt' (us-ascii)
output 'Scary.Movie.2000.en.00106539.sub' from 'Scary Movie - ENG.txt' (us-ascii)
output 'Scary.Movie.2000.en.00117707.sub' from 'scream_english.sub' (iso-8859-1)
output 'Scary.Movie.2000.en.00203573.sub' from 'Scary Movie - ENG.txt' (us-ascii)
output 'Scary.Movie.2000.en.00204203.sub' from 'Scary Movie_engl.sub' (iso-8859-1)
output 'Scary.Movie.2000.en.03112243.srt' from 'Scary Movie 1 (2000).en.bug-fixed.srt' (Windows-1252)
output 'Scary.Movie.2000.en.03142326.srt' from 'kns-sm.srt' (Windows-1252)
output 'Scary.Movie.2000.en.03279944.srt' from 'Scary Movie 1 iNT DvD RiP- WaCkOs.srt' (Windows-1252)
output 'Scary.Movie.2000.en.03318665.srt' from 'rvlt-scarymovie.srt' (us-ascii)
output 'Scary.Movie.2000.en.03552139.srt' from 'Scary Movie.srt' (us-ascii)
output 'Scary.Movie.2000.en.03686957.sub' from 'Scary.Movie.(2000).DVDRIP.Divx.DOMiNION.sub' (iso-8859-1)
output 'Scary.Movie.2000.en.04867080.srt' from 'Scary.Movie.2000.BrRip.720p.x264.YIFY-eng.srt' (Windows-1252)
output 'Scary.Movie.2000.en.05115082.srt' from 'Scary Movie 1.[2000].UNRATED.DVDRIP.XVID.[Eng]-DUQA®.srt' (Windows-1252)
...

subtitles server

to run your own subtitles server, see docs/wsgi/ to expose get-subs.py as a WSGI script on an HTTP server

demo server

see also subtitles-servers.txt

feel free to add your own subtitles server

can i use your server

because i get stupid questions like "but can i use your server...?"

feel free to download a million subtitles every day from my subtitles server, i dont care. i only care about performance issues, in effect "how can i serve more subtitles in less CPU time?"

for example, i could store the database files on SSD drives, but that is too expensive for my taste (FeralHosting Neon - 150 GB SSD - 15 GBP/month = 17.50 EUR/month = 20 USD/month)

to make this faster for yourself, you can just run your own subtitles server, which requires about 200 GB of disk space for all the database files

can i create my own subtitles client

if you want to create your own subtitles client, then you are probably trying to reinvent the wheel, and you should look at existing opensubtitles clients:

from there it should be trivial to integrate my subtitles server

just please dont hardcode the server URLs, but instead, store the server URLs in a config file like ~/.config/my-subs-client.yaml, so users can change the server URLs when my servers go down. support for multiple subtitles servers should be a first-class feature, similar to bittorrent trackers

see also docs/integration-with-opensubtitles-mirrors.md

based on

offline version of opensubtitles

useful for subtitle-fetchers like

scraping

opensubtitles.org is protected by cloudflare, so im using a scraping proxy (zenrows.com). with max_concurrency = 10 in fetch-subs.py, one request takes about 0.2 seconds.

videos:

running the scraper

git clone https://github.com/milahu/opensubtitles-scraper
cd opensubtitles-scraper

git submodule update --init

# install dependencies with nix
# https://github.com/NixOS/nix
./shell.nix.sh

# fetch milahu's temporary files to continue scraping
# note: this will fetch all branches
# the "shard branches are called remotes/origin/shards-102xxxxx etc
git clone https://github.com/milahu/opensubtitles-scraper-new-subs

# mount all "shard" branches in opensubtitles-scraper-new-subs/shards/
./opensubtitles-scraper-new-subs/mount-branches.sh

# TODO add your opensubtitles.org VIP accounts here
# so you get subtitles without ads
# so you can 1000 subtitles per day per VIP account
cp fetch_subs_secrets.py.example fetch_subs_secrets.py
$EDITOR fetch_subs_secrets.py

# infinite loop: run the scraper every 6 hours
./main-loop.sh

similar projects

About

scrape subtitles from opensubtitles.org

Topics

Resources

Stars

57 stars

Watchers

5 watching

Forks

Used by

Contributors

Languages