# Is it legal to scrape public social media data?

> General information, not legal advice: what US court cases, platform terms and privacy laws like GDPR and China's PIPL mean for public data from X, TikTok or YouTube.

Canonical page: https://okdata.online/answers/is-scraping-public-social-media-data-legal/

**Short answer: **Often it can be, but it depends on where you are, how you collect and what you do with the data, so treat this as general information and ask a lawyer about your case. US courts have found that scraping public pages is unlikely to count as hacking, yet contract, copyright and privacy law still apply. A data API such as okdata returns public data only (X search is $0.006 a page), but it does not take the legal responsibility for your use off you.

This page is general information, not legal advice. Laws differ by country and change, and the answer for your project depends on facts only you and your lawyer can weigh. What follows is how the question usually breaks down, so you can ask a lawyer a sharper one.

## Four questions that decide most cases

1. **Is the data public?** Visible without logging in is a very different position from data behind a login, a paywall or a private account.
2. **How is it collected?** Getting around technical barriers, using fake accounts or putting heavy load on a site raises the risk, whatever the data is.
3. **Is it personal information?** Usernames, faces and anything that identifies a person stay personal data even when posted publicly.
4. **What happens next?** Aggregate analysis is treated very differently from republishing posts, selling profiles or targeting individuals.

## What courts and laws have said

- In the US, the Ninth Circuit held in [hiQ v. LinkedIn](https://en.wikipedia.org/wiki/HiQ_Labs_v._LinkedIn) (2022) that scraping publicly accessible profiles is unlikely to be access "without authorization" under the federal anti-hacking law. The same dispute still ended with hiQ agreeing to stop and delete the data, after rulings on LinkedIn's contract claims.
- In January 2024 a federal court found that [Meta's terms did not cover logged-out scraping of public data by Bright Data](https://techcrunch.com/2024/01/24/court-rules-in-favor-of-a-web-scraper-bright-data-which-meta-had-used-and-then-sued/). Commentators stress how fact-specific that ruling is.
- Privacy laws do not exempt public posts. China's PIPL allows handling information people made public [only within a reasonable scope](https://www.cac.gov.cn/2021-08/20/c_1631050028355286.htm), and needs consent where the handling significantly affects them. The EU's GDPR likewise needs a lawful basis for personal data, public or not.
- Copyright in post text, images and video stays with the creator.

## Collect less, and say so

Data minimisation is the cheapest risk reduction there is. If you analyse what people say, you rarely need who said it:

```bash
curl -G "https://api.okdata.online/v1/youtube/videos/comments/list" \
  -H "Authorization: Bearer $OKDATA_API_KEY" \
  --data-urlencode 'id=dQw4w9WgXcQ' \
  --data-urlencode 'fields=text,likes,published_at'
```

That returns comment text, likes and time, without authors.

## Where an API fits

okdata returns public data only, with no login, cookie or account on either side, through endpoints such as [X post search](/apis/x/posts/search/), [TikTok video search](/apis/tiktok/videos/search/) and [YouTube video comments](/apis/youtube/videos/comments/list/). That settles the how-is-it-collected question for your side, but not the last two: what personal data you keep and what you do with it are still yours to decide, and to check with counsel. For an analysis-first workflow that keeps personal data out, see [word-of-mouth research](/solutions/word-of-mouth/).

## Endpoints used

- [X post search](https://okdata.online/apis/x/posts/search/) `x.posts.search`: $0.006 per call · about 20 posts per page
- [TikTok video search](https://okdata.online/apis/tiktok/videos/search/) `tiktok.videos.search`: $0.002 per call · about 30 videos per page
- [YouTube video comments](https://okdata.online/apis/youtube/videos/comments/list/) `youtube.videos.comments.list`: $0.004 per call · about 20 comments per page

Updated 2026-11-12
