1. Use cases
  2. RAG over social video

RAG over social video

Fetch timestamped transcripts, chunk them, and index them for retrieval.

The job

Segments carry start and end times, so an answer can link to the second it came from. Fetch, chunk by time, embed, and keep the video url as metadata.

Endpoints

Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.

EndpointReturnsCost
YouTube search1 credit
Transcript from any video URL1 credit
YouTube video transcript1 credit
Batch requestsThe sum of each sub-request's charge
Create a monitorFree

Recipe

  1. Search for the videos on your topic.
  2. Fetch a transcript with segments for each.
  3. Chunk by time, embed, store the url and start time.
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 search14found = get("/v1/youtube/search", query="retrieval augmented generation", type="video", duration="long")15# Transcript from any video URL16doc = get("/v1/transcript", url=found["items"][0]["url"])1718chunks, buf, start = [], [], None19for seg in doc["segments"]:20    start = seg["start"] if start is None else start21    buf.append(seg["text"])22    if seg["end"] - start >= 60:23        chunks.append({"url": doc["url"], "start": start, "text": " ".join(buf)})24        buf, start = [], None

Calls use api.socialscrape.dev and return the shapes in the reference.

Good to know

Many transcripts at once go in one batch call. Agents can call the same endpoints as tools through the MCP server, which runs on your machine.

Related

Questions

Can an agent call this without glue code?
Yes, through the MCP server, which you run on your machine and which exposes the same endpoints as tools.