Upcoming Change to YouTube Video Page URLs
March 8th, 2010 | Published in Youtube API
There's an upcoming change to YouTube video page URLs that we wanted developers to know about. While it's not something that will directly affect users of the YouTube APIs, chances are there are some developers in the audience who have code that parses existing YouTube video page URLs, possibly to extract a video's id.
Here's what some users will start seeing: URLs for YouTube video pages will change from the format http://www.youtube.com/watch?v=ylLzyHk54Z0 to http://www.youtube.com/watch#!v=ylLzyHk54Z0. That is to say, the ? character in the URL will be replaced with #! characters. Not all users will be directed to the new URLs, and the change will be implemented gradually over time. This change is part of a larger AJAX rewrite of the YouTube web site. The old-format URLs will continue working indefinitely when used for browser navigation, so if your web site has existing links to YouTube video pages, you don't need to worry about them breaking.
What we're concerned about is developers who have written code that takes a user-supplied YouTube video page URL as input and attempts to parse out the video id using a method that assumes there will be a ? character in the URL. If you have such code, you will need to make it flexible enough to support both styles of URLs. In both formats, the value of the v parameter will be the video id, but other URL parameters in an arbitrary order may also be present in valid URLs.
You might be tempted to parse YouTube URLs when generating HTML snippets that embed videos on your web pages. We recommend that you don't take that approach. Our oEmbed service can take care of that for you. oEmbed will happily take watch page URLs of either format as input and return a proper HTML embed code that you can use.
Cheers,
-Jeff Posnick, YouTube API Team