I'm writing code to validate YouTube URLs. Is it guaranteed that the video ID, such as
oHg5SJYRHA0, is always exactly 11 characters long, or can it sometimes be shorter or longer? Is there any official documentation about this?
They'll probably stick to 11 chars for a long time. Each character has 64 possible values:
2*26 letters (lowercase and uppercase) + 10 for the digits, + 2 for "_" and "-" chars
2 * 26 + 10 + 2 = 64
Then 11 characters in total:
64^11 = 73786976294838210000 (or more or less "73,7e18")
Of course not all combination will be used, depending on their algorithm, but they are probably not going to change it anytime soon. Words from a YouTube developer state that they do not guarantee, though: http://osdir.com/ml/youtube-api-gdata/2009-10/msg00237.htmlTweet