YouTube URL algorithm?

后端 未结 11 1879
遇见更好的自我
遇见更好的自我 2020-12-04 09:39

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

Example:

  • http://www.youtube.com/watch?v=CvUN8qg9lsk
11条回答
  •  星月不相逢
    2020-12-04 10:35

    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.

提交回复
热议问题