The job
A video is a draft of a post. Pull the transcript with timestamps, and quote or summarize the parts worth reusing.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/youtube/channel/videos | YouTube channel videos | 1 credit |
GET /v1/youtube/video/transcript | YouTube video transcript | 1 credit |
GET /v1/tiktok/video/transcript | TikTok video transcript | 1 credit |
GET /v1/transcript | Transcript from any video URL | 1 credit |
Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.
Recipe
- List the channel's latest videos.
- Fetch a transcript for each.
- Send the text to your editor or your model.
Preview
The API is in early access. Calls use
api.socialscrape.io and return the shapes in the reference.Python
import os
import requests
API = "https://api.socialscrape.io"
HEADERS = {"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]}
def get(path, **params):
res = requests.get(API + path, headers=HEADERS, params=params, timeout=60)
res.raise_for_status()
return res.json()["data"]
# YouTube channel videos
videos = get("/v1/youtube/channel/videos", handle="mkbhd", sort="latest")
# YouTube video transcript
transcript = get("/v1/youtube/video/transcript", url=videos["items"][0]["url"])
print(transcript["source"], len(transcript["segments"]))
print(transcript["text"][:500])TypeScript
const API = "https://api.socialscrape.io";
const headers = { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! };
async function get(path: string, params: Record<string, string | number | boolean>) {
const query = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)]));
const res = await fetch(`${API}${path}?${query}`, { headers });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
return (await res.json()).data;
}
// YouTube channel videos
const videos = await get("/v1/youtube/channel/videos", { handle: "mkbhd", sort: "latest" });
// YouTube video transcript
const transcript = await get("/v1/youtube/video/transcript", { url: videos.items[0].url });
console.log(transcript.source, transcript.segments.length);
console.log(transcript.text.slice(0, 500));Good to know
Captions cost 1 credit. Videos without captions can be transcribed from audio, billed by minute; check source in the response.