使用场景

用字幕转录把 YouTube 视频变成可搜索的知识库

以 JSON 获取带时间戳的 YouTube 完整字幕转录,每个视频链接一份,用于 RAG 索引、摘要、引述或内容再利用。

预付费,无订阅REST 或 MCP一个密钥搞定模型、数据和智能体
YouTubelovelyjsonitems[0]"video": "youtube.com/watch?v=d…"lang": "en""segments": 412"start": "00:03:12""text": "so the key is to grin…"auto_generated": false

你要找的答案藏在一场两小时的演讲、一个会议播放列表,或某位创始人的每周视频里,而没有人会把它们全部看完。转录让这些内容可以被搜索、被引用,也能被模型使用。Lovely Router 替你获取转录:传入视频链接,每份带时间戳的转录返回一个 JSON 对象,按转录份数从预付费余额中计费。用一个 API 密钥,就能把结果交给向量库、摘要工具或 AI 智能体。

交给你的 AI 智能体

把这段提示词复制到 Claude Code、Cursor、Codex 或任何编程智能体中。它会告诉智能体文档在哪里,以及如何使用你的 API 密钥。

用字幕转录把 YouTube 视频变成可搜索的知识库. Use the Lovely Router data tools: each returns JSON and is billed per result.

- Docs (read first): https://lovelyrouter.com/docs/tools/find.md and https://lovelyrouter.com/docs/tools/run.md
- Plan first: POST https://lovelyrouter.com/v1/tools/suggest with `{"task": "<my task in plain words>"}` (free). It returns the tools to run in order, each with an example `input`, the `input_required` fields, an estimated cost and a ready-made `run` request. Replace the example values with my task's; if a field is unclear, read the tool with GET https://lovelyrouter.com/v1/tools/<id>. To browse instead, POST https://lovelyrouter.com/v1/tools/discover searches the catalog.
- Show me the plan and its estimated cost (`total_est_cost_usd`) before running anything large.
- Run: POST https://lovelyrouter.com/v1/tools/<id>/run with `{"input": {...}, "max_results": N}`. A 200 has the finished run with `items`; a 202 means it is still running, so poll the `poll` path until `status` is `succeeded`, `failed`, `timed_out` or `stopped`.
- Only delivered results are billed. Keep max_results small on the first run, check the output, then scale up.
- If you support MCP, connect https://lovelyrouter.com/mcp instead (Streamable HTTP, same key; https://lovelyrouter.com/docs/tools/mcp.md) and use suggest_tools, get_tool and run_tool.
- Auth: read my API key from the LOVELY_API_KEY environment variable and send it as `Authorization: Bearer $LOVELY_API_KEY`. Never print or commit the key. If it is not set, ask me to create one at https://lovelyrouter.com/app/keys.
- Billing is prepaid: every call is charged to my balance, so test with a small request before running anything large.
- Every docs page is plain Markdown; the full index is https://lovelyrouter.com/llms.txt.

My task: <the inputs (links, keywords or accounts) and how many results you need>
01

工作原理

010203
  1. 收集你想建立索引的 youtube.com/watch?v= 或 youtu.be/ 链接:一门课程、一场会议、竞品的频道,或你自己的历史视频库。

  2. 设置上限后运行工具

    把链接放进 startUrls 发送到 POST /v1/tools/youtube-transcript/run,如需指定字幕语言就加上 lang,并用 max_results 作为运行上限。运行会从你的余额中预留它的最高费用,并以 JSON 返回转录。

  3. 建立索引或生成摘要

    把每份转录切成保留时间戳的片段,做向量嵌入后存储。这样搜索命中的结果就能链接到视频中的确切时刻。

02

一次请求获取转录

{}

获取 YouTube 转录在 startUrls 中接受视频链接,每个链接对应一份转录,另有可选的 lang 字幕语言代码,如 en、es、de 或 pt-BR。自动生成的字幕也算。lang 留空时返回视频的默认字幕轨。一次运行最多读取 50 个视频:

curl https://lovelyrouter.com/v1/tools/youtube-transcript/run \
  -H "Authorization: Bearer $LOVELY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "input": {
      "startUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
      "lang": "en"
    },
    "max_results": 1
  }'

运行超过 60 秒仍未结束时会返回 202;轮询方法见运行工具。

03

每份转录包含什么

{}
Field groupWhat you get
文本视频的完整转录(字幕)
时间文本对应的时间戳
语言你指定的语言(视频有该语言时)

不接受 Shorts、直播和播放列表链接:请传入单个视频链接。视频没有你所要求语言的字幕时,就无法返回该语言。

04

使用方案

为整个频道建立 RAG 索引。

用 youtube-channel 列出频道的视频,把链接发到这里,将转录切块,再在回答问题时附上指向时间戳的链接。

总结一场会议。

运行活动中的每一场演讲,让模型为每场写出五条要点的摘要,再发布成一个页面。

摘录引述。

在转录中搜索某个名字、产品或说法,并引用对应的视频和时间点。

再利用你自己的视频。

把转录变成博客文章、新闻通讯或节目笔记,由模型负责改写。

为全球团队翻译。

视频有 es 或 de 字幕时直接请求,而不是从英文翻译。

更想用自然语言?连接 MCP 服务器,然后告诉 Claude Code 或 Cursor:"获取 talks.txt 中 12 个链接的英文转录,为每个写出五条要点的摘要,并标出核心观点的时间戳,汇总成一个 markdown 文件。把 max_results 设为 12。"

06

费用说明

按转录计费:开始运行时会预留最高费用,即单次调用费加上单份转录费乘以 max_results,运行结束后按实际返回的数量结算,其余预留金额退回你的余额。失败或超时的运行只为已交付的转录付费,开始时就被拒绝的运行不收费。

为 200 个视频建立索引,按 200 份转录计费。没有订阅,也没有每月最低消费:从 $5 起充值,一份余额同时支付工具和模型。上方卡片显示今日价格;价格页列出了每个工具。

07

常见问题

?
没有字幕的视频也能用吗?+

它返回视频已有的字幕,自动生成的字幕也算。如果视频没有你所要求语言的字幕,就没有该语言的内容可返回。

可以选择语言吗?+

可以,用 lang(例如 en、es、de 或 pt-BR),前提是视频有该字幕轨。留空则使用默认字幕轨。

转录有时间戳吗?+

有,转录带有时间戳。

可以发送播放列表或 Shorts 链接吗?+

不可以。不支持播放列表、直播和 Shorts 链接。请发送单个视频链接,格式为 youtube.com/watch?v= 或 youtu.be/。

一次运行最多处理多少个视频?+

最多 50 个。更长的列表请发起多次运行。

需要订阅吗?+

不需要。你向预付费余额充值,每次运行从中扣费。失败的运行只为已交付的结果付费,也不会自动续费。

正在构建会读取资料来源的智能体?请参阅研究智能体、社交聆听和工具目录。

一个预付费密钥,搞定模型、数据和智能体

无需订阅。充值后按需使用,每笔费用都能在日志中查看。