loom-transcript
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLoom Transcript Fetcher
Loom字幕获取工具
Fetch the transcript from a Loom video using Loom's GraphQL API.
使用Loom的GraphQL API获取Loom视频的字幕。
Instructions
操作说明
Given the Loom URL: $ARGUMENTS
给定Loom链接:$ARGUMENTS
1. Extract the Video ID
1. 提取视频ID
Parse the Loom URL to extract the 32-character hex video ID. Supported URL formats:
https://www.loom.com/share/<video-id>https://www.loom.com/embed/<video-id>https://www.loom.com/share/<video-id>?sid=<session-id>
The video ID is the 32-character hex string after or .
/share//embed/解析Loom链接以提取32位十六进制的视频ID。支持的链接格式:
https://www.loom.com/share/<video-id>https://www.loom.com/embed/<video-id>https://www.loom.com/share/<video-id>?sid=<session-id>
视频ID是或之后的32位十六进制字符串。
/share//embed/2. Fetch Video Metadata
2. 获取视频元数据
Use the tool to POST to to get the video title and details.
WebFetchhttps://www.loom.com/graphqlUse this curl command via Bash:
bash
curl -s 'https://www.loom.com/graphql' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-loom-request-source: loom_web_45a5bd4' \
-H 'apollographql-client-name: web' \
-H 'apollographql-client-version: 45a5bd4' \
-d '{
"operationName": "GetVideoSSR",
"variables": {"id": "<VIDEO_ID>", "password": null},
"query": "query GetVideoSSR($id: ID!, $password: String) { getVideo(id: $id, password: $password) { ... on RegularUserVideo { id name description createdAt owner { display_name } } } }"
}'使用工具向发送POST请求,获取视频标题和详情。
WebFetchhttps://www.loom.com/graphql通过Bash执行以下curl命令:
bash
curl -s 'https://www.loom.com/graphql' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-loom-request-source: loom_web_45a5bd4' \
-H 'apollographql-client-name: web' \
-H 'apollographql-client-version: 45a5bd4' \
-d '{
"operationName": "GetVideoSSR",
"variables": {"id": "<VIDEO_ID>", "password": null},
"query": "query GetVideoSSR($id: ID!, $password: String) { getVideo(id: $id, password: $password) { ... on RegularUserVideo { id name description createdAt owner { display_name } } } }"
}'3. Fetch the Transcript URLs
3. 获取字幕链接
Use curl via Bash to call the GraphQL API:
bash
curl -s 'https://www.loom.com/graphql' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-loom-request-source: loom_web_45a5bd4' \
-H 'apollographql-client-name: web' \
-H 'apollographql-client-version: 45a5bd4' \
-d '{
"operationName": "FetchVideoTranscript",
"variables": {"videoId": "<VIDEO_ID>", "password": null},
"query": "query FetchVideoTranscript($videoId: ID!, $password: String) { fetchVideoTranscript(videoId: $videoId, password: $password) { ... on VideoTranscriptDetails { id video_id source_url captions_source_url } ... on GenericError { message } } }"
}'Replace with the actual video ID extracted in step 1.
<VIDEO_ID>The response contains:
- — JSON transcript URL
source_url - — VTT (WebVTT) captions URL
captions_source_url
通过Bash执行curl命令调用GraphQL API:
bash
curl -s 'https://www.loom.com/graphql' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-loom-request-source: loom_web_45a5bd4' \
-H 'apollographql-client-name: web' \
-H 'apollographql-client-version: 45a5bd4' \
-d '{
"operationName": "FetchVideoTranscript",
"variables": {"videoId": "<VIDEO_ID>", "password": null},
"query": "query FetchVideoTranscript($videoId: ID!, $password: String) { fetchVideoTranscript(videoId: $videoId, password: $password) { ... on VideoTranscriptDetails { id video_id source_url captions_source_url } ... on GenericError { message } } }"
}'将替换为步骤1中提取的实际视频ID。
<VIDEO_ID>响应包含:
- — JSON格式字幕的链接
source_url - — VTT(WebVTT)格式字幕的链接
captions_source_url
4. Download and Parse the Transcript
4. 下载并解析字幕
Fetch both URLs returned from step 3 (if available):
- VTT captions (): Download with
captions_source_url. This is a WebVTT file with timestamps and text.curl -sL "<url>" - JSON transcript (): Download with
source_url. This is a JSON file with transcript segments.curl -sL "<url>"
Prefer the VTT captions as the primary source since they include proper timestamps. Fall back to the JSON transcript if VTT is unavailable.
获取步骤3返回的两个链接(如果可用):
- VTT字幕 ():使用
captions_source_url下载。这是包含时间戳和文本的WebVTT文件。curl -sL "<url>" - JSON字幕 ():使用
source_url下载。这是包含字幕分段的JSON文件。curl -sL "<url>"
优先使用VTT字幕作为主要来源,因为它包含标准的时间戳。如果VTT不可用,则回退到JSON字幕。
5. Present the Transcript
5. 展示字幕
Format and present the full transcript to the user:
Video: [Title from metadata]
Author: [Owner name]
Date: [Created date]
0:00 - First transcript segment text...
0:14 - Second transcript segment text...
(continue for all segments)
将完整字幕格式化后展示给用户:
视频: [元数据中的标题]
作者: [所有者名称]
日期: [创建日期]
0:00 - 第一段字幕文本...
0:14 - 第二段字幕文本...
(所有分段依次展示)
Error Handling
错误处理
- If the GraphQL response contains a , report the error message to the user.
GenericError - If both and
source_urlare null/missing, tell the user that no transcript is available for this video.captions_source_url - If the video URL is invalid or the ID cannot be extracted, ask the user for a valid Loom URL.
- 如果GraphQL响应包含,将错误消息告知用户。
GenericError - 如果和
source_url均为null或缺失,告知用户该视频没有可用字幕。captions_source_url - 如果视频链接无效或无法提取ID,请用户提供有效的Loom链接。
Notes
注意事项
- No authentication or cookies are required — Loom's transcript API is publicly accessible.
- Only English transcripts are available through this API.
- Transcripts are auto-generated and may contain minor errors.
- 无需身份验证或Cookie — Loom的字幕API是公开可访问的。
- 该API仅支持英语字幕。
- 字幕为自动生成,可能存在少量错误。