Scrape TikTok from Python: search videos by keyword, then pull the comments of any video with likes, reply counts and timestamps. No browser, no signing tricks and no proxy: each call is one POST request to the EveryInfra API.
Also covers: TikTok scraper API, how to scrape TikTok comments.
git clone https://github.com/everyinfra/tiktok-scraper-python.git
cd tiktok-scraper-python
pip install -r requirements.txt
export EVERYINFRA_API_KEY=your_key # get one at everyinfra.com
python main.py search "python tutorial" --out videos.csv
python main.py comments https://www.tiktok.com/@user/video/<id> --out comments.csvGet an API key: everyinfra.com/en/docs. Without --out, the script prints the first three rows as JSON.
| Call | Price per 1,000 calls | Rows per call |
|---|---|---|
tiktok/search |
$0.56 | 10 in our test |
tiktok/comments |
$0.56 | 20 in our test |
- You pay per call, not per month. Failed calls and empty results are not charged.
- New accounts can claim $1 of trial credit: create an account, star everyinfra-agent-plugins and seo-skills, then claim it in the console. It is valid for 24 hours and needs no card. See pricing.
| Field | Meaning |
|---|---|
id |
The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
url |
Link to the record on the platform. |
text |
Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
author_name |
Author's display name. |
author_username |
Author's username (@handle), usually usable in URLs. |
like_count |
Likes. null means the platform or this capability does not disclose it; it is not 0. |
comment_count |
Comments. null means not disclosed, not 0. |
share_count |
Shares. null means not disclosed, not 0. |
view_count |
Views or plays. null means not disclosed, not 0. |
posted_at |
Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
collect_count |
Saves or favorites. null means not disclosed, not 0. |
repost_count |
Reposts (as distinct from quote posts). null means not disclosed. |
duration_sec |
Duration in seconds. |
duration_seconds |
Duration in seconds. null for content that is not video or audio. |
cover_image_url |
Cover image link. |
language |
Content language code (for example zh, en) as judged by the platform; it can be wrong. |
country |
Country or region: a full name or an ISO code depending on the platform, not normalized. |
hashtags |
Hashtags in the text, in order of appearance; absent when there are none. |
author_id |
Author's unique ID on the platform. |
author_url |
Link to the author's profile on the platform. |
author_avatar_url |
Author's profile picture link. |
author_follower_count |
Author's follower count. null means not disclosed. |
platform |
Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
Also returned, named as on the platform: music, is_ad, is_pinned, is_sponsored, is_slideshow, has_shop_product, author_bio, author_is_verified, author_is_private, author_is_seller, author_following_count, author_like_count, author_video_count.
Full parameter list: TikTok search API.
| Field | Meaning |
|---|---|
id |
The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
text |
Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
author_username |
Author's username (@handle), usually usable in URLs. |
author_id |
Author's unique ID on the platform. |
like_count |
Likes. null means the platform or this capability does not disclose it; it is not 0. |
reply_count |
Replies, usually replies to a comment. null means not disclosed. |
posted_at |
Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
platform |
Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
Also returned, named as on the platform: reply_to_id, is_reply, liked_by_author, pinned_by_author.
Full parameter list: TikTok comments API.
We ran both commands against the live API before publishing this repository (times in Singapore time, UTC+8).
| Command | Run at (SGT) | Rows | Charged |
|---|---|---|---|
search "python tutorial" |
2026-11-08 03:37 | 10 | $0.000556 |
comments https://www.tiktok.com/@user/video/<id> |
2026-11-08 03:37 | 20 | $0.000556 |
First row of the search result (long text cut, author fields left out of this sample):
{
"id": "7695603639427157269",
"url": "https://www.tiktok.com/@hackswithbanks4/video/7695603639427157269",
"text": "🐍 LEARN PYTHON IN 10 MINUTES — BEGINNER'S GUIDE ⚠️ DISCLAIMER: This tutorial is for educational purposes. P...",
"like_count": 6607,
"comment_count": 36,
"share_count": 368,
"view_count": 43973,
"posted_at": "2026-10-12T02:32:37+00:00",
"collect_count": 2826,
"repost_count": 0,
"duration_sec": 633,
"language": "en",
"country": "NG",
"hashtags": [
"python",
"learnpython",
"pythonprogramming",
"codingforbeginners",
"programming"
],
"is_ad": false,
"platform": "tiktok",
"duration_seconds": 633
}Every call is one request. everyinfra.py wraps it in about 60 lines of requests:
curl -X POST https://api.everyinfra.com/api/v1/social \
-H "Authorization: Bearer $EVERYINFRA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"platform": "tiktok", "action": "search", "params": {"keyword": "python tutorial"}}'- Slow actions (Instagram
user_posts, for example) answer with ajob_id. The script pollsGET /api/v1/jobs/{job_id}every 5 seconds; polling is free. - Errors come back as JSON with a code, a message and whether you were charged. A missing parameter returns 422 before any charge.
- The same key also works over MCP for Claude, Cursor and other AI agents: docs.
- TikTok API on EveryInfra: every TikTok action, with prices and live health
- Other examples: google-maps-scraper · instagram-scraper-python · tiktok-trends-api · douyin-api-python
MIT