Disclosure: I build Wyzie Subs, the API used below. It has a free key; anything that needs Pro is marked.
If you run a video site or a self-made player, subtitles tend to become a side project of their own: find a source, match the right file to the right episode, convert SRT to something the browser plays, and fix CORS. Here is the short path.
1. Search by TMDB or IMDB id
# A movie (TMDB id) curl "https://sub.wyzie.io/search?id=286217&language=en&key=YOUR_KEY" # A TV episode, two languages curl "https://sub.wyzie.io/search?id=1399&season=1&episode=1&language=en,es&key=YOUR_KEY" IMDB ids work too, just keep the tt. Results come back best first, and best=1 returns only the top match.
Each result has language (a BCP 47 tag like en or pt-BR), display (the language name), flagUrl and isHearingImpaired. That is everything a subtitle menu needs.
2. Ask for WebVTT
Browsers only play WebVTT in a <track>. Add to=vtt to a result's url and the API converts it for you:
<video id="player" controls crossorigin="anonymous"> <source src="/media/episode.m3u8" type="application/x-mpegURL" /> <track kind="subtitles" srclang="en" label="English" src="SUBTITLE_URL&to=vtt" default /> </video> hls.js plays into a normal <video>, so the same <track> works. Video.js and Plyr read <track> children as well, and Video.js can add one after load:
player.addRemoteTextTrack({ kind: 'subtitles', srclang: sub.language, label: sub.display, src: sub.url + '&to=vtt', }, false); 3. CORS is already handled
Responses carry Access-Control-Allow-Origin: *, and preflight requests are answered without a key and are never billed. The one thing you add is crossorigin="anonymous" on the <video>, because the track comes from another origin.
4. Don't put your key in the page
Anyone can read page JavaScript in DevTools. Two safe options:
- Search from your own server and send only the result links to the browser. Each link carries an encrypted token, not your key, and opens only its own file.
- Use a browser-safe key (Pro). It only works from the sites you list, only for search and download, and stops at its own daily cap.
5. Cache the search, not the file
Download links stay valid for 60 days, so store the search answer per title and episode instead of searching on every play. Serve each file from its Wyzie link rather than re-hosting it (the terms don't allow re-hosting).
Extras that save support tickets
- Out of sync? The
shiftandfpsdownload options fix a fixed delay or frame-rate drift, free. - A whole catalogue?
POST /search/batchruns up to 50 searches in one call, from your server. - A family site? Add
censor=1to a download link to mask swear words (f***) at no extra cost. It needs Wyzie Censored (Pro) turned on for the account.
Cost
A free key gives 1,000 requests a day on the free sources (one request per source searched, one per download). Pro is $5 once for 2,000,000 requests and adds every source.
Full guide with the same code: docs.wyzie.io/subs/streaming-sites. Free key: sub.wyzie.io/redeem.
Questions about edge cases (anime ids, odd encodings, hearing-impaired tracks) are welcome in the comments.