Academic research with social media data: an API method
For academic research, apply first to the official programs if you qualify (TikTok's Research API, Meta Content Library, the YouTube Researcher Program), and use a public data API for the platforms and questions they do not cover. A 2,000-video TikTok study with transcripts and comments costs about 8,500 credits on ScrapeIO, about $15.98, and unused credits carry over to the next study.
Social media research needs data you can describe, defend and, ideally, let others reproduce. That means a documented sampling method, a log of every request, consistent timing, and an ethics plan. An API helps with all four, because every request is a URL with parameters and a timestamp. This page covers where to get data, how to collect it well, and what it costs.
Who does this and why
- Graduate students and faculty in communication, political science, public health and computational social science.
- Journalists and fact-checkers who need defensible numbers behind a story.
- Non-profit researchers studying harms, health information or elections.
Start with the official programs
If you qualify, official research access is usually the strongest option for a paper, because the platform stands behind the data.
- TikTok Research API. Open to academic institutions in the U.S., EEA, UK, Canada and Switzerland, with a separate track for not-for-profit research bodies in the EU. Applicants need a defined proposal, evidence of ethical review and independence from commercial interests (TikTok). Our TikTok Research API comparison covers the trade-offs.
- Meta Content Library. Access to public content from Facebook, Instagram and WhatsApp Channels, with Threads in the web tool, for researchers at academic institutions and qualifying not-for-profits (Meta).
- YouTube Researcher Program. Scaled access to YouTube's public data for eligible researchers from many disciplines (YouTube).
Applications take time, and not every project qualifies: students without an endorsing advisor, researchers outside the listed regions, and studies of platforms with no program. That is where a public data API fits. For the EU's legal route for researchers and other access changes, see social media data trends in 2026.
The data you need
| Step | Platform | Endpoint | Credits |
|---|---|---|---|
| 1. Build the sample | TikTok | TikTok keyword search, TikTok hashtag search | 1 per page |
| 1. Build the sample | YouTube, Reddit | YouTube search (2), Reddit search (1) | 1 or 2 |
| 2. Fixed-age metrics | TikTok, YouTube | TikTok video, YouTube video | 1 |
| 3. Content as text | TikTok, YouTube | TikTok transcript, YouTube transcript | 1 |
| 4. Audience response | TikTok, YouTube, Reddit | TikTok comments, YouTube comments, Reddit comments | 1 per page |
| Other sources | Telegram, Bluesky | Telegram channel posts, Bluesky user posts | 1 per page |
Worked example: a 2,000-video TikTok study
- Sample: 20 search queries x 25 pages = 500 credits, deduplicated to about 2,000 videos.
- Metrics snapshot for every video at 7 days old: 2,000 credits.
- Transcripts: 2,000 credits.
- 2 pages of comments per video: 4,000 credits.
- Total: 8,500 credits, about $15.98 on the $47 pack.
The study fits in one pack with 16,500 credits left. Credits never expire, so the remainder carries to a follow-up study or a replication. There is no subscription to cancel when the grant ends.
Code: log every request
import requests, json, datetime, hashlib
KEY = "YOUR_KEY"
LOG = open("collection_log.jsonl", "a")
def fetch(path, **params):
t = datetime.datetime.utcnow().isoformat() + "Z"
r = requests.get("https://scrapeio.com" + path, params=params,
headers={"x-api-key": KEY}, timeout=60).json()
LOG.write(json.dumps({"t": t, "path": path, "params": params,
"success": r.get("success"), "cached": r.get("cached"),
"credits": r.get("credits_used")}) + "\n")
return r
def pseudonym(handle, salt="project-secret"):
return hashlib.sha256((salt + handle.lower()).encode()).hexdigest()[:16]
r = fetch("/v1/tiktok/search/keyword", query="vaccine side effects", sort_by="relevance")
rows = [{"id": v["id"], "author": pseudonym(v["author"]["handle"]),
"created_at": v["created_at"], "plays": v["plays"]}
for v in r["data"]["items"]]
The log is your methods section in raw form: what you asked, when, and what came back. The cached flag tells you whether an answer was fresh.
Method choices to make and report
- Sampling frame. Platform search is ranked, not random. Say so, report the exact queries and dates, and frame findings as about "content surfaced by search for these terms".
- Fixed age. Views and likes keep growing. Collect metrics at the same age for every post (for example 7 days after posting), and report that age.
- Saturation. Page deeper until new pages add few new ids. Report where you stopped and why.
- Coding reliability. If people label content, have two coders label an overlap sample and report Cohen's kappa = (observed agreement - chance agreement) / (1 - chance agreement).
- Distributions. Engagement is heavily skewed. Report medians and interquartile ranges, and use log scales or rank-based tests.
Ethics and data handling
- Get your ethics board's review before collection, even for public data.
- Collect only the fields your question needs. Pseudonymize handles at collection time, as in the code above.
- Do not quote posts word for word in a paper if a quote can be searched back to a private person, unless your ethics plan covers it.
- Share post ids and your code, not full content, so others can rebuild the dataset while deleted posts stay deleted.
- Read the platform's terms. This is not legal advice; our post on whether web scraping is legal summarizes the main cases.
Run it from an AI agent
Agents are useful for scoping, not for the final collection. With the MCP server in Claude Code:
Run TikTok keyword searches for these 5 terms and tell me how many
unique videos each returns over 5 pages, how many overlap between terms,
and the date range covered. Do not fetch comments.
Use the answer to size the study and pick queries. Then run the logged script for the real collection, so every request is recorded and repeatable.
Doing it with ScrapeIO
TikTok, YouTube, Reddit, Telegram, Bluesky and more come from one key with the same fields, prepaid credits that never expire, and no charge for failed or not-found calls. It works alongside official researcher access, for the platforms and questions the programs do not reach.
Sources
Checked on 8 November 2026 from each vendor's own pages. Prices and limits change; follow the links before you decide.
- https://developers.tiktok.com/products/research-api/
- https://transparency.meta.com/researchtools/meta-content-library
- https://research.youtube/
100 free credits, no card. Credits never expire.
Get API key