网淘吧来吧,欢迎您!

Youtube Playlist技能使用说明

2026-03-29 新闻来源:网淘吧 围观:12
电脑广告
手机广告

YouTube播放列表

通过以下方式浏览播放列表并获取字幕TranscriptAPI.com.

设置

如果$TRANSCRIPT_API_KEY未设置,请帮助用户创建一个账户(100个免费积分,无需信用卡):

Youtube Playlist

步骤 1 — 注册:询问用户的电子邮件地址。

node ./scripts/tapi-auth.js register --email USER_EMAIL

→ 一次性密码(OTP)将发送到该邮箱。询问用户:"请检查您的邮箱,获取6位验证码。"

步骤 2 — 验证:当用户提供OTP后:

node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODE

API密钥将保存到~/.openclaw/openclaw.json文件。详情请见下方文件写入部分。修改前会对现有文件进行备份。

手动操作选项:transcriptapi.com/signup→ 仪表盘 → API密钥。

文件写入

verify和save-key命令将API密钥保存到~/.openclaw/openclaw.json(设置skills.entries.transcriptapi.apiKeyenabled: true)。修改前,现有文件会备份到~/.openclaw/openclaw.json.bak

要在代理之外的终端/CLI中使用API密钥,请手动添加到您的shell配置文件中:export TRANSCRIPT_API_KEY=<您的密钥>

API参考

完整的OpenAPI规范:transcriptapi.com/openapi.json— 请查阅此文件以获取最新的参数和模式。

GET /api/v2/youtube/playlist/videos — 1 积分/页

分页的播放列表视频列表(每页100个)。接受playlist— YouTube播放列表URL或播放列表ID。

# First page
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_PLAYLIST_ID" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"

# Next pages
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数必填验证
播放列表条件性播放列表URL或ID(PL/UU/LL/FL/OL前缀)
继续条件性非空字符串

请只提供以下之一:播放列表继续,不能同时提供两者。

可接受的播放列表ID前缀:

  • PL——用户创建的播放列表
  • UU— 频道上传播放列表
  • LL— 喜欢的视频
  • FL— 收藏夹
  • OL— 其他系统播放列表

响应:

{
  "results": [
    {
      "videoId": "abc123xyz00",
      "title": "Playlist Video Title",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "channelTitle": "Channel Name",
      "channelHandle": "@handle",
      "lengthText": "10:05",
      "viewCountText": "1.5M views",
      "thumbnails": [{ "url": "...", "width": 120, "height": 90 }],
      "index": "0"
    }
  ],
  "playlist_info": {
    "title": "Best Science Talks",
    "numVideos": "47",
    "description": "Top science presentations",
    "ownerName": "TED",
    "viewCount": "5000000"
  },
  "continuation_token": "4qmFsgKlARIYVVV1...",
  "has_more": true
}

分页流程:

  1. 首次请求:?playlist=PLxxx— 返回前100个视频 +continuation_token
  2. 后续请求:?continuation=TOKEN— 返回下100个 + 新令牌
  3. 重复直至has_more: falsecontinuation_token: null

工作流程:播放列表 → 字幕

# 1. List playlist videos
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_PLAYLIST_ID" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"

# 2. Get transcript from a video in the playlist
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=VIDEO_ID&format=text&include_timestamp=true&send_metadata=true" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"

从URL提取播放列表ID

https://www.youtube.com/playlist?list=PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf这个播放列表的ID是PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf。你也可以直接将完整的URL传递给playlist参数。

错误

代码含义操作
400两个参数都提供或都没提供请只提供`playlist`或`continuation`参数中的一个
402额度不足transcriptapi.com/billing
404播放列表未找到检查播放列表是否为公开状态
408超时请重试一次
422播放列表格式无效必须是一个有效的播放列表URL或ID

每页1个积分。免费套餐:100积分,300次请求/分钟。

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第326284名访客 今日有221篇新文章/评论