YouTube video captions by video id — SRT, XML, JSON3, text
justoneapi.x.youtube-get-video-captions-v1Retrieve available caption tracks for a YouTube video or request captions in SRT, XML, JSON3, or plain-text format.
- Prix
- $0.01476/successAu prix catalogue
- Taux de réussite
- —Aucune donnée de taux de réussite pour le moment30 derniers jours · 2 appels
- Latence p50
- ——
- Dernière vérification
- —Pas encore vérifié
GEThttps://toolswitch.dev/v1/tools/justoneapi.x.youtube-get-video-captions-v1?format=srt&videoId=dQw4w9WgXcQBeta- Utilise le quota de la plateforme
- Réponse synchrone
- Lit des données publiques
Paramètres
| Paramètre | Type | Obligatoire | Description | Exemple |
|---|---|---|---|---|
| Paramètres de requête | ||||
format | chaîne | Facultatif | Caption output format. Available Values: - `srt`: SubRip caption format with timeline cues - `xml`: Original XML caption format - `json3`: YouTube original JSON caption structure - `txt`: Plain text without timeline cues One of: srt, xml, json3, txt. | srt |
videoId | chaîne | Obligatoire | The unique identifier for a YouTube video. | dQw4w9WgXcQ |
languageCode | chaîne | Facultatif | Caption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks. | |
- Paramètres de requête
formatchaîneFacultatifCaption output format. Available Values: - `srt`: SubRip caption format with timeline cues - `xml`: Original XML caption format - `json3`: YouTube original JSON caption structure - `txt`: Plain text without timeline cues One of: srt, xml, json3, txt.
Exemple :
srtvideoIdchaîneObligatoireThe unique identifier for a YouTube video.
Exemple :
dQw4w9WgXcQlanguageCodechaîneFacultatifCaption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.
Exemples de code
Remplacez $TOOLSWITCH_KEY par la clé créée dans la console.
curl -X GET 'https://toolswitch.dev/v1/tools/justoneapi.x.youtube-get-video-captions-v1?format=srt&videoId=dQw4w9WgXcQ' \
-H "X-Toolswitch-Key: $TOOLSWITCH_KEY"import os
import requests
response = requests.request(
"GET",
"https://toolswitch.dev/v1/tools/justoneapi.x.youtube-get-video-captions-v1?format=srt&videoId=dQw4w9WgXcQ",
headers={"X-Toolswitch-Key": os.environ["TOOLSWITCH_KEY"]},
)
response.raise_for_status()
print(response.text)const response = await fetch("https://toolswitch.dev/v1/tools/justoneapi.x.youtube-get-video-captions-v1?format=srt&videoId=dQw4w9WgXcQ", {
method: "GET",
headers: {
"X-Toolswitch-Key": process.env.TOOLSWITCH_KEY ?? "",
},
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.text());Cette API de passerelle est en version Beta ; son URL et son authentification peuvent changer. Les paramètres de l’exemple sont des données fictives. Les appels sont facturés à $0.01476/success, frais de service inclus.