1. Use cases
  2. Trend research from platform feeds

Trend research from platform feeds

Read what is trending on each platform today and store the snapshot.

The job

Trends are a time series. Take the same snapshot daily and the list of what rose becomes a query on your own table.

Endpoints

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

EndpointReturnsCost
Popular TikTok videos1 credit
TikTok videos by hashtag1 credit
TikTok song details1 credit
Instagram trending reels1 credit
Trending YouTube Shorts1 credit
GitHub trending repositories1 credit

Recipe

  1. Fetch each trending feed.
  2. Save it with the date.
  3. Diff against yesterday.
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# Popular TikTok videos14popular = get("/v1/tiktok/videos/popular", period=7, sort="views")15# GitHub trending repositories16repos = get("/v1/github/trending/repositories", since="weekly", language="python")1718for v in popular["items"][:10]:19    print(v["stats"]["views"], v["url"])20for r in repos["items"][:10]:21    print(r["url"])

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

Good to know

The feeds (Instagram Reels, YouTube Shorts, TikTok For You) differ on every call. They sample a feed; they are not a chart.

Related