The job
Many shows publish audio on Spotify and video on YouTube. List episodes from one, transcribe the other, and keep both urls.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/spotify/search | Spotify search | 1 credit |
GET /v1/spotify/podcast | Spotify podcast | 1 credit |
GET /v1/spotify/podcast/episodes | Spotify podcast episodes | 1 credit |
GET /v1/youtube/playlist | YouTube playlist videos | 1 credit |
GET /v1/youtube/video/transcript | YouTube video transcript | 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
- Search for the show.
- List its episodes.
- Fetch the transcript of the matching YouTube video.
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"]
# Spotify search
found = get("/v1/spotify/search", query="Hard Fork", type="show")
# Spotify podcast episodes
episodes = get("/v1/spotify/podcast/episodes", url=found["items"][0]["url"])
for e in episodes["items"][:5]:
print(e["published_at"], e["url"])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;
}
// Spotify search
const found = await get("/v1/spotify/search", { query: "Hard Fork", type: "show" });
// Spotify podcast episodes
const episodes = await get("/v1/spotify/podcast/episodes", { url: found.items[0].url });
for (const e of episodes.items.slice(0, 5)) console.log(e.published_at, e.url);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.