- Use cases
- Content repurposing from transcripts
Content repurposing from transcripts
List a channel's videos, fetch each transcript, and write from the text.
The job
A video is a draft of a post. Pull the transcript with timestamps, and quote or summarize the parts worth reusing.
Endpoints
Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.
| Endpoint | Returns | Cost |
|---|---|---|
| YouTube channel videos | 1 credit | |
| YouTube video transcript | 1 credit | |
| TikTok video transcript | 1 credit | |
| Transcript from any video URL | 1 credit |
Recipe
- List the channel's latest videos.
- Fetch a transcript for each.
- Send the text to your editor or your model.
1import os2import requests34API = "https://api.socialscrape.dev"5HEADERS = {"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]}678def get(path, **params):9 res = requests.get(API + path, headers=HEADERS, params=params, timeout=60)10 res.raise_for_status()11 return res.json()["data"]1213# YouTube channel videos14videos = get("/v1/youtube/channel/videos", handle="mkbhd", sort="latest")15# YouTube video transcript16transcript = get("/v1/youtube/video/transcript", url=videos["items"][0]["url"])1718print(transcript["source"], len(transcript["segments"]))19print(transcript["text"][:500])1const API = "https://api.socialscrape.dev";2const headers = { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! };34async function get(path: string, params: Record<string, string | number | boolean>) {5 const query = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)]));6 const res = await fetch(`${API}${path}?${query}`, { headers });7 if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);8 return (await res.json()).data;9}1011// YouTube channel videos12const videos = await get("/v1/youtube/channel/videos", { handle: "mkbhd", sort: "latest" });13// YouTube video transcript14const transcript = await get("/v1/youtube/video/transcript", { url: videos.items[0].url });1516console.log(transcript.source, transcript.segments.length);17console.log(transcript.text.slice(0, 500));Calls use api.socialscrape.dev and return the shapes in the reference.
Good to know
Captions cost 1 credit. Videos without captions can be transcribed from audio, billed by minute; check source in the response.
Related
Questions
What does AI transcription cost?
1 credit up to 2 minutes of audio, then 5 per started minute of the whole video. See AI transcription.