scraping-youtube-playlist
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScraping Youtube Playlist
抓取YouTube播放列表
Raw data collection. No assumed use case — returns the full dataset for downstream analysis.
原始数据采集。不预设使用场景——返回完整数据集以供下游分析。
Inputs
输入参数
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| array | Optional | | YouTube playlist URLs |
| array | Optional | | Search keywords to find playlists |
| string | Optional | | Country code (e.g. |
| string | Optional | | Language code (e.g. |
| string | Optional | | Sort order |
| number | Optional | Unlimited | Maximum videos to return |
| string | Optional | — | JavaScript function to transform each output object |
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| array | 可选 | | YouTube播放列表URL |
| array | 可选 | | 用于查找播放列表的搜索关键词 |
| string | 可选 | | 国家代码(例如 |
| string | 可选 | | 语言代码(例如 |
| string | 可选 | | 排序顺序 |
| number | 可选 | 无限制 | 返回的最大视频数量 |
| string | 可选 | — | 用于转换每个输出对象的JavaScript函数 |
How to Run
运行方式
Using run_actor.js (recommended)
使用run_actor.js(推荐)
bash
undefinedbash
undefinedQuick answer (table)
快速查看结果(表格形式)
node scripts/run_actor.js --actor "apidojo~youtube-playlist-scraper" --input '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}'
node scripts/run_actor.js --actor "apidojo~youtube-playlist-scraper" --input '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}'
Save as CSV
保存为CSV文件
node scripts/run_actor.js --actor "apidojo~youtube-playlist-scraper" --input '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}' --output results.csv --format csv
node scripts/run_actor.js --actor "apidojo~youtube-playlist-scraper" --input '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}' --output results.csv --format csv
Save as JSON
保存为JSON文件
node scripts/run_actor.js --actor "apidojo~youtube-playlist-scraper" --input '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}' --output results.json --format json
undefinednode scripts/run_actor.js --actor "apidojo~youtube-playlist-scraper" --input '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}' --output results.json --format json
undefinedREST API fallback
REST API备选方案
bash
curl -X POST "https://api.apify.com/v2/acts/apidojo~youtube-playlist-scraper/runs" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}'If Apify MCP is available:
Use the Apify MCP tool with actor and the input above.
call_actorapidojo~youtube-playlist-scraperbash
curl -X POST "https://api.apify.com/v2/acts/apidojo~youtube-playlist-scraper/runs" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"startUrls": ["https://www.youtube.com/playlist?list=PLABCDE12345"], "maxItems": 50}'若Apify MCP可用:
使用Apify MCP的工具,指定actor为并传入上述输入参数。
call_actorapidojo~youtube-playlist-scraperOutput Fields
输出字段
| Field | Type | Description |
|---|---|---|
| string | Always |
| string | Video ID |
| string | Video title |
| string | Video URL |
| string | Video description |
| number | Duration in seconds |
| number | View count |
| number | Like count |
| string | Availability status |
| string | Channel ID |
| string | Channel name |
| string | Channel URL |
| array | Video tags/keywords |
| boolean | Live stream flag |
| boolean | Private flag |
| array | Thumbnail objects |
| 字段 | 类型 | 描述 |
|---|---|---|
| string | 始终为 |
| string | 视频ID |
| string | 视频标题 |
| string | 视频URL |
| string | 视频描述 |
| number | 时长(秒) |
| number | 观看量 |
| number | 点赞数 |
| string | 可用状态 |
| string | 频道ID |
| string | 频道名称 |
| string | 频道URL |
| array | 视频标签/关键词 |
| boolean | 直播标识 |
| boolean | 私有标识 |
| array | 缩略图对象 |
Edge Cases
边缘情况
- Private playlist: Returns 0 results. Tell user the playlist is private.
- Deleted playlist: Returns error or empty. Check URL.
- Very large playlist: Use maxItems to cap results and avoid long run times.
- Mix playlist (YouTube auto-generated): May behave differently than user-created playlists.
- 私有播放列表:返回0条结果。告知用户该播放列表为私有。
- 已删除的播放列表:返回错误或空结果。请检查URL。
- 超大播放列表:使用maxItems限制结果数量,避免运行时间过长。
- 混合播放列表(YouTube自动生成):表现可能与用户创建的播放列表不同。