CodeIgniter Forums
Youtube urls and other video sites urls, why that way ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Youtube urls and other video sites urls, why that way ? (/showthread.php?tid=34500)



Youtube urls and other video sites urls, why that way ? - El Forum - 10-01-2010

[eluser]Twisted1919[/eluser]
As the title say, i am trying to understand, what's the reason why, for example youtube uses urls like :
Code:
http://www.youtube.com/watch?v=uelHwf8o7_U
instead of :
Code:
http://www.youtube.com/watch?v=1234567
I mean, what's the real reason why they are not using the database ID of the video, and they are using a random string ?

On the other hand, vimeo uses something like : http://vimeo.com/15261921 , so it's the database id .


Youtube urls and other video sites urls, why that way ? - El Forum - 10-01-2010

[eluser]CroNiX[/eluser]
you have infinitely more possibilities using upper/lowercase letters in addition to numbers. Also, who is to say that the random upper/lowercase letters+numbers isn't a unique db ID field? It is after all, unique.


Youtube urls and other video sites urls, why that way ? - El Forum - 10-01-2010

[eluser]Jônatan fróes[/eluser]
it works like short url systems:
Code:
ex:
1 = a
2 = b
...
10 = j
25 = z
26 = A
This way the urls won't be so large.


Youtube urls and other video sites urls, why that way ? - El Forum - 10-01-2010

[eluser]Twisted1919[/eluser]
Thank you both, while waiting for the reply here i made a some research and i found this article:
http://kevin.vanzonneveld.net/techblog/article/create_short_ids_with_php_like_youtube_or_tinyurl/
which explains why these are used and of course how to create and use them.
Basically is like Jonatan says, the database id is converted into a string then you can convert the string back so that you can use the database id .
Another advantage is that if you use them , the urls won't be predictable anymore so this stops automated crawlers/boots/harvesters to look into your site.