Subtitle Extraction API
Note
API Overview
This API is used to extract video subtitles. Currently, only YouTube is supported. If you need support for other platforms, please contact customer service.
🎯 Basic Information
| Item | Details |
|---|---|
| Endpoint | https://api.meowload.net/openapi/extract/subtitles |
| Method | POST |
| Content-Type | application/json |
📋 Request Parameters
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | API key, obtained from the Developer Management Center |
accept-language | string | - | Error message language, defaults to enSupported: zh, en, ja, es, de, etc. |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Video share link URL |
Request Example
curl -X POST https://api.meowload.net/openapi/extract/subtitles \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-here" \
-H "accept-language: zh" \
-d '{
"url": "https://www.youtube.com/watch?v=bdLEBN6JKPY"
}'🟢 Success Response
HTTP Status Code:
200 OK
Response Example
{
"id": "bdLEBN6JKPY",
"text": "Germán Santillán: A taste of Mexico's ancient chocolate-making tradition | TED",
"description": "Dating back more than 800 years, chocolate is deeply woven into the Indigenous history of Oaxaca, Mexico. TED Fellow Germán Santillán talks about his work reviving the Mixtec technique used to prepare this ancient delicacy by training a new generation of local farmers -- helping create economic opportunity and preserve a delicious legacy at the same time.",
"duration": 363,
"published_at": "2021-09-13T08:00:32-07:00",
"thumbnail_url": "https://i.ytimg.com/vi_webp/bdLEBN6JKPY/maxresdefault.webp",
"subtitles": [
{
"language_name": "Chinese (China)",
"language_tag": "zh-CN",
"urls": [
{
"url": "https://www.youtube.com/api/timedtext?fmt=srt&lang=zh-CN&v=bdLEBN6JKPY",
"format": "srt"
},
{
"url": "https://www.youtube.com/api/timedtext?fmt=vtt&lang=zh-CN&v=bdLEBN6JKPY",
"format": "vtt"
}
]
},
{
"language_name": "English",
"language_tag": "en",
"urls": [
{
"url": "https://www.youtube.com/api/timedtext?fmt=srt&lang=en&v=bdLEBN6JKPY",
"format": "srt"
},
{
"url": "https://www.youtube.com/api/timedtext?fmt=vtt&lang=en&v=bdLEBN6JKPY",
"format": "vtt"
}
]
}
]
}Response Field Descriptions
| Field | Type | Always Returned | Description |
|---|---|---|---|
id | string | - | Video ID |
text | string | Yes | Video title |
description | string | - | Detailed video description |
duration | number | - | Video duration (seconds) |
published_at | string | - | Video publish time |
thumbnail_url | string | - | Video thumbnail URL |
subtitles | array | Yes | Subtitle list array |
subtitles Array Fields
| Field | Type | Always Returned | Description |
|---|---|---|---|
language_name | string | Yes | Language name (e.g., “Chinese (China)“) |
language_tag | string | Yes | Language tag (e.g., “zh-CN”) |
urls | array | Yes | Subtitle download links in various formats for this language |
urls Array Fields
| Field | Type | Always Returned | Description |
|---|---|---|---|
format | string | Yes | Subtitle formatsrt, vtt, ttml, json3, srv1, srv2, srv3 |
url | string | Yes | Subtitle file download URL |
🔴 Error Response
HTTP Status Code: non-
200(e.g., 400, 401, 402, 422, 500)
Error Response Example
{
"message": "链接格式错误"
}HTTP Status Code Reference
| Status Code | Description | Common Cause | Solution |
|---|---|---|---|
200 | Success | - | - |
400 | Business Error | Extraction failed, link contains no valid media | Check if the link is correct and contains video/images, etc. |
401 | Authentication Failed | Invalid or expired API Key | Verify that x-api-key is correct |
402 | Credits Exhausted | API call quota used up | Visit the Management Center to top up |
422 | Parameter Error | Incorrect link format | Check the url parameter format |
500 | Server Error | Internal server error | Contact technical support |
💻 Code Examples
Python
import requests
api_url = "https://api.meowload.net/openapi/extract/subtitles"
api_key = "your-api-key-here"
payload = {
"url": "https://www.youtube.com/watch?v=bdLEBN6JKPY"
}
headers = {
"x-api-key": api_key,
"accept-language": "zh"
}
response = requests.post(api_url, json=payload, headers=headers)
if response.status_code == 200:
data = response.json()
print(f"✅ Extraction successful!")
print(f"Video title: {data['text']}")
print(f"Subtitle languages: {len(data['subtitles'])}")
# Download the first language's SRT subtitle
if data['subtitles']:
first_lang = data['subtitles'][0]
print(f"\nDownloading {first_lang['language_name']} subtitles...")
# Find the SRT format
srt_url = next(
(u['url'] for u in first_lang['urls'] if u['format'] == 'srt'),
None
)
if srt_url:
subtitle_response = requests.get(srt_url)
with open(f"{first_lang['language_tag']}.srt", 'wb') as f:
f.write(subtitle_response.content)
print(f"✅ Subtitle saved: {first_lang['language_tag']}.srt")
else:
error = response.json()
print(f"❌ Request failed: {error['message']}")Golang
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
type SubtitlesRequest struct {
URL string `json:"url"`
}
type SubtitleURL struct {
URL string `json:"url"`
Format string `json:"format"`
}
type Subtitle struct {
LanguageName string `json:"language_name"`
LanguageTag string `json:"language_tag"`
URLs []SubtitleURL `json:"urls"`
}
type SubtitlesResponse struct {
ID string `json:"id"`
Text string `json:"text"`
Description string `json:"description"`
Duration int `json:"duration"`
PublishedAt string `json:"published_at"`
ThumbnailURL string `json:"thumbnail_url"`
Subtitles []Subtitle `json:"subtitles"`
}
func main() {
apiURL := "https://api.meowload.net/openapi/extract/subtitles"
apiKey := "your-api-key-here"
requestBody := SubtitlesRequest{
URL: "https://www.youtube.com/watch?v=bdLEBN6JKPY",
}
jsonData, _ := json.Marshal(requestBody)
req, _ := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", apiKey)
req.Header.Set("accept-language", "zh")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Printf("❌ Request failed: %v\n", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 {
var result SubtitlesResponse
json.Unmarshal(body, &result)
fmt.Println("✅ Extraction successful!")
fmt.Printf("Video title: %s\n", result.Text)
fmt.Printf("Subtitle languages: %d\n", len(result.Subtitles))
// Download the first language's SRT subtitle
if len(result.Subtitles) > 0 {
firstLang := result.Subtitles[0]
fmt.Printf("\nDownloading %s subtitles...\n", firstLang.LanguageName)
// Find the SRT format
var srtURL string
for _, urlInfo := range firstLang.URLs {
if urlInfo.Format == "srt" {
srtURL = urlInfo.URL
break
}
}
if srtURL != "" {
subtitleResp, _ := http.Get(srtURL)
defer subtitleResp.Body.Close()
subtitleData, _ := io.ReadAll(subtitleResp.Body)
filename := firstLang.LanguageTag + ".srt"
os.WriteFile(filename, subtitleData, 0644)
fmt.Printf("✅ Subtitle saved: %s\n", filename)
}
}
} else {
fmt.Printf("- Request failed (%d)\n", resp.StatusCode)
}
}💡 Tips
1. Batch Download All Language Subtitles
def download_all_subtitles(video_url, api_key, format='srt', output_dir='subtitles'):
import os
os.makedirs(output_dir, exist_ok=True)
# Get subtitle information
response = requests.post(
"https://api.meowload.net/openapi/extract/subtitles",
json={"url": video_url},
headers={"x-api-key": api_key}
)
if response.status_code != 200:
print(f"❌ Fetch failed: {response.json()['message']}")
return
data = response.json()
# Download the specified format subtitle for all languages
for subtitle in data['subtitles']:
lang_tag = subtitle['language_tag']
lang_name = subtitle['language_name']
# Find the URL for the specified format
url_info = next(
(u for u in subtitle['urls'] if u['format'] == format),
None
)
if url_info:
subtitle_resp = requests.get(url_info['url'])
filename = f"{lang_tag}.{format}"
filepath = os.path.join(output_dir, filename)
with open(filepath, 'wb') as f:
f.write(subtitle_resp.content)
print(f"✅ Download complete: {lang_name} ({filename})")
# Usage example
download_all_subtitles(
"https://www.youtube.com/watch?v=bdLEBN6JKPY",
"your-api-key-here",
format='srt',
output_dir='my_subtitles'
)2. Check for a Specific Language Subtitle
def has_subtitle_language(subtitles, language_tag):
"""Check if subtitles are available in a specific language"""
return any(s['language_tag'] == language_tag for s in subtitles)
# Usage example
if has_subtitle_language(data['subtitles'], 'zh-CN'):
print("✅ Chinese subtitles available")
else:
print("❌ Chinese subtitles not available")3. Subtitle Format Reference
| Format | Full Name | Description | Recommended Use Case |
|---|---|---|---|
srt | SubRip Text | Most commonly used subtitle format | General media players |
vtt | WebVTT | Web video subtitle format | HTML5 video players |
ttml | TTML | XML-based subtitle format | Professional video editing |
json3 | YouTube JSON | JSON format with metadata | Programmatic processing |
srv1 | YouTube Server Format 1 | YouTube server format 1 | YouTube internal use |
srv2 | YouTube Server Format 2 | YouTube server format 2 | YouTube internal use |
srv3 | YouTube Server Format 3 | YouTube server format 3 | YouTube internal use |
Tip
Format Selection Guide
- General download: Recommended to use
srtformat for best compatibility - Web playback: Recommended to use
vttformat with native HTML5 support - Professional editing: Recommended to use
ttmlformat for the richest feature set - Programmatic processing: Recommended to use
json3format for easy parsing - srv series: For special use cases only; most users can ignore these