Fetch Subtitles
Identify an Episode#
Send a few lines of dialogue, a subtitle file or a short clip, and POST /identify tells you which movie or episode it comes from and where in it. The lines are looked up in the quote index, which holds about 623,000 episode files from 17,800 shows and 197,000 movie files.
The API: POST /identify#
Send the lines as JSON. Add times to get offsetMs, and id (with season if you know it) to search one show only.
curl -X POST "https://sub.wyzie.io/identify?key=YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"lines": ["Who are you talking to right now?", "I am the one who knocks."],
"times": [12.5, 15.0],
"id": "tt0903747"
}'| Parameter | Example | Description |
|---|---|---|
| key | YOUR_KEY | Any valid API key, free or Pro. Browser-safe keys are refused. |
| lines | ["I am the one who knocks."] | 1 to 20 lines of dialogue, in order, 3 to 200 characters each. |
| times | [15.0] | Optional. Seconds, one per line: where each line is in your video. Needed for offsetMs. |
| subtitle | "1\n00:00:12,500 --> ..." | A subtitle file's text (srt, vtt or ass) instead of lines. Its first 20 dialogue cues are used, with their times. |
| id | tt0903747 | Optional. Only this show: a TMDB or IMDb id. |
| season | 4 | Optional, with id. Only this season. |
| language | en | Optional. Only lines indexed in this language. Default: every language. |
How Many Lines to Send#
Send 5 to 20 lines. In our test on 30 episodes, 3 lines put the right episode first 73% of the time and 6 lines 83%. In 40 calls with everyday sentences, nothing matched. Lines with names or unusual words work best; short ones like "Yes." add little.
From an Audio or Video Clip#
Paid keys can send a clip as the multipart field media, up to 100 MB. Speech in the first 3 minutes is recognised and then looked up as lines with their times, so you get offsetMs too. The answer also has transcript, the lines that were heard.
curl -X POST "https://sub.wyzie.io/identify?key=YOUR_KEY" \
-F "media=@clip.mp4"A 3-minute clip takes about 30 to 60 seconds. If the answer is not ready within 50 seconds you get 202 with a poll link: GET it with the same key for the result, which is kept for an hour.
Response#
{
"match": {
"imdbId": "tt0903747",
"tmdbId": 1396,
"title": "Breaking Bad",
"year": 2008,
"season": 4,
"episode": 6,
"offsetMs": 1834200,
"confidence": 0.93,
"matchedLines": 3
},
"candidates": [
{
"imdbId": "tt0903747",
"title": "Breaking Bad",
"season": 4,
"episode": 6,
"confidence": 0.93,
"matchedLines": 3
},
{
"imdbId": "tt0903747",
"title": "Breaking Bad",
"season": 5,
"episode": 1,
"confidence": 0.12,
"matchedLines": 1
}
],
"cost": 6
}match is the best fit and candidates holds up to 5, best first. For a movie, season and episode are null. Add offsetMs to a time in your video to get the time in the episode; it is null without times or a clip. confidence runs from 0 to 1 and matchedLines counts the lines that agree.
With wyzie-lib#
identifyEpisode takes lines, a subtitle file or Pro media, polls a slow clip for you and never retries, since each call is billed. No match rejects with a 404 error whose body holds candidates.
import { identifyEpisode } from 'wyzie-lib';
const { match, candidates, cost } = await identifyEpisode({
lines: ['Who are you talking to right now?', 'I am the one who knocks.'],
times: [12.5, 15.0], // optional: gives match.offsetMs
id: 'tt0903747', // optional: only this show
});
if (match) console.log(match.title, match.season, match.episode, match.offsetMs);
// Or a subtitle file's text (its first 20 cues), or a Pro audio or video clip
await identifyEpisode({ subtitle: srtText });
await identifyEpisode({ media: clip }); // a File, Blob or BufferCost#
Lines or a subtitle file cost 2 requests a line: 3 lines cost 6 and 20 lines cost 40. A clip costs 85 requests per started minute of audio (3 minutes at most) plus 2 per recognised line, so 295 at most. The cost is charged up front, and lines that could not be searched are given back. If the index or the speech recognition fails on our side, everything is given back. No match (404) and a clip with no speech (422) keep what ran. At most 60 identifications a minute per key.
Errors
| Status | Meaning |
|---|---|
| 400 | No lines, subtitle or media, or a value out of range. |
| 401 | No key. |
| 402 | The Pro balance is exhausted (same body as /search). |
| 403 | A browser-safe key, or a free key sending media. |
| 404 | No match: no movie or episode fits. Try more lines, or longer ones. |
| 413 | The file is over 100 MB. 3 minutes of audio is enough. |
| 422 | No speech: no speech was found in the clip. |
| 429 | Over 60 identifications a minute for this key. |
| 503 | The quote index or billing is unavailable. Nothing is charged, or the charge is given back. |