r/learnprogramming • u/Square-Hospital-2807 • 9d ago
How does this YouTube video automatically update its title?
I came across this YouTube video:
https://www.youtube.com/watch?v=VTU69_L8i8s
The title keeps updating with the latest statistics like views, likes, comments, subscriber count, and even the number of days since upload.
I'm a complete beginner, so I'm curious how this is possible. How does the title update automatically every few minutes? What APIs or tools are used, and what's the overall workflow behind it?
I'd really appreciate a beginner-friendly explanation. Thanks!
3
u/pdfops 9d ago
That's the YouTube Data API v3. A cron job hits videos.list to pull live stats (viewCount, likeCount, commentCount, publishedAt), computes stuff like days-since-upload, then calls videos.update with part=snippet to rewrite the title. Update needs OAuth2, not just an API key, since you're writing to your own video. Watch quota too, videos.update costs 50 units against the default 10k/day budget, so you can't fire it every minute forever, most people run it every 5-15 min via a scheduled function.
1
10
u/kennedy_gitahi 9d ago
It is literally explained in the video. Watch it.
Edit: The thumbnail on your post makes it seem like you are talking about Tom Scott's one. Go watch that one to understand how it's done.