Hacker News new | ask | show | jobs
by orestis 1622 days ago
YouTube seems to use 10 characters for their video id, does anyone know what is the tech behind that?
3 comments

> YouTube seems to use 10 characters

FYI no commitment is made to that by YouTube.

The API merely defines it as a "string" with no further commitment as to length, format or characters [1]

As for the "how?" there is an unsubstantiated answer based on reverse-engineering posted on SO[2]

    [1] https://developers.google.com/youtube/v3/docs/videos#id
    [2] https://webapps.stackexchange.com/a/101153
There’s a way of using some number theory to generate a random-looking sequence of sort codes without repeating them, I wonder if they do something like that. I implemented the technique in Rust here: https://github.com/paulgb/tiny_id
I remembered it being 11 characters, and indeed: https://www.youtube.com/watch?v=dQw4w9WgXcQ.