You want to revisit several passages in a YouTube lecture without repeatedly scrubbing through the video. Existing captions can support that task, provided you preserve their source and limitations.
Confirm the video and available languages
Retrieve video information with video_id. Calling the caption endpoint without language_code returns the available-language list. Choose from the actual options rather than assuming a particular translation exists. Keep the language code and do not treat automatic captions as an author-approved transcript.
Choose a format for the review task
Use srt when timestamps help you return to the passage, or txt for plain reading. The contract also lists xml and json3. Plain text does not retain timing, so do not invent precise playback positions later from paragraph order.
Handle processing as a task state
A larger video may return processing with job_id. Query the result endpoint for that task; queued or active means it is not finished. Follow the documented retry flow instead of creating duplicate tasks. If captions are unavailable, record the gap. This workflow does not create a new speech transcription for an uncaptioned video.
Keep notes separate from captions
Preserve the retrieved text and write your own topic index separately. AI may organize it, but verify terms, names and numbers against the video. Your register can include source, language, format, task state, return position and uncertain wording. The final notes should distinguish existing video text from your interpretation.
Requests used in this project
- Get video information:https://api.trmesh.com/openapi/api/v1/youtube/web_v2/get_video_info · Documentation
- Get video captions:https://api.trmesh.com/openapi/api/v1/youtube/web_v2/get_video_captions · Documentation
- Get video captions async job result:https://api.trmesh.com/openapi/api/v1/youtube/web_v2/get_video_captions_result · Documentation
Request URL and parameters
GET https://api.trmesh.com/openapi/api/v1/youtube/web_v2/get_video_info
| Parameter | Type | Required | Meaning |
|---|---|---|---|
video_id |
string | Yes | Video ID |
language_code |
string | No | Language code |
need_format |
boolean | No | Whether to clean and format the data |
Run the Python example
Install requests and set TRMESH_API_TOKEN in your environment. Replace the sample identifiers with the public object you intend to inspect. Example IDs may no longer be available.
import os
import requests
# Read your own developer key from the server environment.
url = "https://api.trmesh.com/openapi/api/v1/youtube/web_v2/get_video_info"
params = {
"video_id": "oaSNBz4qMQY",
"language_code": "zh-CN"
}
response = requests.get(
url, params=params, timeout=30,
headers={"Authorization": f"Bearer {os.environ['TRMESH_API_TOKEN']}"},
)
response.raise_for_status()
payload = response.json()
print(payload) # Inspect the actual response before mapping fields
Endpoint documentation · Free profile tool
API calls use your TRMesh account allowance. Check the endpoint price before running a script.