Skip to content

TranscriptFor marketers, newsletters & research, developers

Get a YouTube Shorts transcript and read its hook

Get a YouTube Short's transcript from its link, in the playground or one API call, read the first line as the hook, and get on-screen text.

2 min readBy CleanScriptMarkdown

On this page
  1. An example
  2. What's different about a Short
  3. Go further

To get the transcript of a YouTube Short, paste its link into the playground or send it in one request. You get the full text, and its first line is the hook.

curl
curl -G https://api.cleanscript.ai/v1/transcript \
  -H "Authorization: Bearer $CLEANSCRIPT_API_KEY" \
  --data-urlencode "url=https://www.youtube.com/shorts/VgSFtZ7UGCE"
Python
# pip install cleanscript-ai
from cleanscript_ai import CleanScript

client = CleanScript()
result = client.transcript("https://www.youtube.com/shorts/VgSFtZ7UGCE")
print(result.text)

Every form of the link works: youtube.com/shorts/VgSFtZ7UGCE, youtu.be/VgSFtZ7UGCE, youtube.com/watch?v=VgSFtZ7UGCE, or just VgSFtZ7UGCE.

An example #

NASA's #PassThePhone with NASA and CSA's Artemis II Lunar Flyby Astronauts runs 38 seconds. NASA wrote its own captions, so they come back as written (source: "creator"). The text starts:

I'm passing the phone to someone with an infectious smile, who has done four spacewalks. I'm passing the phone to someone who is a great surfer. I'm passing the phone to a great friend and Mr. Cool, Calm, and Collected Canadian astronaut.

The hook is the first sentence, and the whole Short repeats its pattern: "I'm passing the phone to". Seeing that structure without watching again is what a transcript is for.

Many Shorts have only automatic captions. This one's automatic track reads and Mr cool calm and collected Canadian; that is what CleanScript corrects when there is nothing better (source: "auto"). See how auto captions get cleaned.

What's different about a Short #

The opening is most of it. Read the first line as the hook. For its exact times, add include=["lines"] and look at the first line's start and end. A Short usually comes back as one section.

It can run longer than you think. YouTube allows Shorts up to three minutes. post.duration has the length.

On-screen text isn't in the captions. Many Shorts print the hook over the first frames. When a Short has no speech, the text on screen comes back in on_screen_text automatically. When it has speech, add include=["on_screen_text"] to get both; that adds 1 credit.

No captions isn't an error. Without usable captions, we transcribe the audio (source: "transcribed"). A Short with only music returns empty text and a no_speech warning.

Go further #

Sources

  1. Use automatic captioning - YouTube Help
  2. Upload YouTube Shorts - YouTube Help

Spot something wrong? Tell us.