- Use cases
- Podcast and show research
Podcast and show research
List a show's episodes, then fetch the transcript of the video version.
The job
Many shows publish audio on Spotify and video on YouTube. List episodes from one, transcribe the other, and keep both urls.
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 |
|---|---|---|
| Spotify search | 1 credit | |
| Spotify podcast | 1 credit | |
| Spotify podcast episodes | 1 credit | |
| YouTube playlist videos | 1 credit | |
| YouTube video transcript | 1 credit |
Recipe
- Search for the show.
- List its episodes.
- Fetch the transcript of the matching YouTube video.
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# Spotify search14found = get("/v1/spotify/search", query="Hard Fork", type="show")15# Spotify podcast episodes16episodes = get("/v1/spotify/podcast/episodes", url=found["items"][0]["url"])1718for e in episodes["items"][:5]:19 print(e["published_at"], e["url"])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// Spotify search12const found = await get("/v1/spotify/search", { query: "Hard Fork", type: "show" });13// Spotify podcast episodes14const episodes = await get("/v1/spotify/podcast/episodes", { url: found.items[0].url });1516for (const e of episodes.items.slice(0, 5)) console.log(e.published_at, e.url);Calls use api.socialscrape.dev and return the shapes in the reference.
Good to know
Spotify lists episodes 20 a page. Matching a Spotify episode to its YouTube video is a step you do by title and date.