Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YouTube URL algorithm?

Tags:

algorithm

How would you go about generating the unique video URL's that YouTube uses?

Example:

  • http://www.youtube.com/watch?v=CvUN8qg9lsk
like image 445
BenB Avatar asked Jun 14 '10 03:06

BenB


People also ask

How is YouTube URL generated?

It's a randomly generated string of fixed length and contains a very specific set of characters. No duplicates are allowed. Show activity on this post. As the accepted answer indicates, take a number, then apply a sequence of "bijective" (or reversible) operations on the number to get a hashed number.

Will YouTube ever run out of URLs?

Tech Expert Tom Scott Explains Why YouTube Will Never Run Out Of Unique URLs. Ten years after its inception, YouTube counts billions of video views each day, and its worldwide popularity is only increasing.

What base does YouTube URLs use?

More videos on YouTube Every YouTube video has a unique ID based on a counting system called Base 64. Randomly generated, that Base 64 ID allows YouTube to have a unique yet short url by using the alphabet in lowercase and uppercase plus two symbols: – and _.

How many YouTube URL combinations are there?

At the current length of 11 characters, YouTube has some 73,786,976,294,838,206,464 URLs to work with. Or as Tom Scott puts it, enough for everyone on Earth to upload one video every minute for thousands of years.


1 Answers

YouTube uses Base64 encoding to generate IDs for each video.Characters involved in generating Ids consists of

(A-Z) + (a-z) + (0-9) + (-) + (_). (64 Characters).

Using Base64 encoding and only up to 11 characters they can generate 73+ Quintilian unique IDs.How much large pool of ID is that?

Well, it's enough for everyone on earth to produce video every single minute for 18000 years.

And they have achieved such huge number by only using 11 characters (64*64*64*64*64*64*64*64*64*64*64) if they need more IDs they will just have to add 1 more character to their IDs.

So when video is uploaded on YouTube they basically randomly select from 73+ Quintilian possibility and see if its already taken or not.if not use it otherwise look for another one.

Refer to this video for detailed explanation.

like image 125
Sunil Kumar Jha Avatar answered Sep 21 '22 19:09

Sunil Kumar Jha