scraping-tiktok-posts-by-location

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Scraping Tiktok Posts By Location

按位置抓取TikTok帖子

Raw data collection. No assumed use case — returns the full dataset for downstream analysis.

原始数据收集。不预设使用场景——返回完整数据集以供下游分析。

Inputs

输入参数

ParameterTypeRequiredDefaultNotes
startUrls
array
[]
TikTok location/place URLs (e.g.
https://www.tiktok.com/tag/newyork?location=true
)
maxItems
numberOptionalUnlimitedMaximum posts to return
customMapFunction
stringOptionalJavaScript function to transform each output object
参数类型是否必填默认值说明
startUrls
array
[]
TikTok位置/场所URL(例如
https://www.tiktok.com/tag/newyork?location=true
maxItems
number可选无限制返回的最大帖子数量
customMapFunction
string可选用于转换每个输出对象的JavaScript函数

How to Run

运行方式

Using run_actor.js (recommended)

使用run_actor.js(推荐方式)

bash
undefined
bash
undefined

Quick answer (table)

快速返回表格结果

node scripts/run_actor.js --actor "apidojo~tiktok-location-scraper" --input '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}'
node scripts/run_actor.js --actor "apidojo~tiktok-location-scraper" --input '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}'

Save as CSV

保存为CSV格式

node scripts/run_actor.js --actor "apidojo~tiktok-location-scraper" --input '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}' --output results.csv --format csv
node scripts/run_actor.js --actor "apidojo~tiktok-location-scraper" --input '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}' --output results.csv --format csv

Save as JSON

保存为JSON格式

node scripts/run_actor.js --actor "apidojo~tiktok-location-scraper" --input '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}' --output results.json --format json
undefined
node scripts/run_actor.js --actor "apidojo~tiktok-location-scraper" --input '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}' --output results.json --format json
undefined

REST API fallback

REST API备用方案

bash
curl -X POST "https://api.apify.com/v2/acts/apidojo~tiktok-location-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}'
If Apify MCP is available: Use the Apify MCP
call_actor
tool with actor
apidojo~tiktok-location-scraper
and the input above.

bash
curl -X POST "https://api.apify.com/v2/acts/apidojo~tiktok-location-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://www.tiktok.com/place/New-York-City-123456"], "maxItems": 100}'
若Apify MCP可用: 使用Apify MCP的
call_actor
工具,指定Actor为
apidojo~tiktok-location-scraper
并传入上述输入参数。

Output Fields

输出字段

FieldTypeDescription
id
stringTikTok post ID
title
stringPost caption/text
views
numberView count
likes
numberLike count
comments
numberComment count
shares
numberShare count
bookmarks
numberBookmark/save count
hashtags
arrayHashtags used in post
channel.name
stringCreator display name
channel.username
stringCreator @username
channel.verified
booleanVerification status
uploadedAt
numberUpload timestamp (Unix)
uploadedAtFormatted
stringUpload timestamp (ISO 8601)
video.url
stringVideo file URL
video.duration
numberDuration in seconds
song.title
stringAudio track title
postPage
stringFull post URL
字段类型描述
id
stringTikTok帖子ID
title
string帖子标题/文案
views
number浏览量
likes
number点赞数
comments
number评论数
shares
number分享数
bookmarks
number收藏数
hashtags
array帖子中使用的话题标签
channel.name
string创作者显示名称
channel.username
string创作者@用户名
channel.verified
boolean认证状态
uploadedAt
number上传时间戳(Unix格式)
uploadedAtFormatted
string上传时间戳(ISO 8601格式)
video.url
string视频文件URL
video.duration
number视频时长(秒)
song.title
string音频曲目名称
postPage
string帖子完整URL

Edge Cases

边缘情况

  • No location URL: This actor requires a TikTok location page URL, not a city name. Ask user to navigate to TikTok > search the location > copy the URL.
  • Low results: Some locations have few tagged posts — return what's available.
  • Private videos: Excluded automatically.
  • Deleted location: Returns empty. URL may be stale.
  • 无位置URL:该Actor需要TikTok位置页面的URL,而非城市名称。请引导用户进入TikTok > 搜索该位置 > 复制URL。
  • 结果数量少:部分位置的标签帖子数量较少——返回现有可用内容即可。
  • 私密视频:自动排除。
  • 已删除的位置:返回空结果。URL可能已失效。