For some reason I run into this issue a lot. I get to a YouTube mobile page on my iPhone, and not wanting to view the video that moment, I save it to Instapaper. But when I go back to view it, it doesn’t work. I get a generic YouTube Mobile page.
But I noticed that the video ID is embedded in the URL. The browser just doesn’t want to see it for some reason. Luckily, Javascript can fix this easily.
Drag the bookmarklet to your Bookmarks Bar. When you encounter a YouTube Mobile page that shows up as a generic “front page,” click the bookmarklet, and it should load the original video you had saved.
Translate YouTube Mobile ← Drag this to your Bookmarks Bar
Here is the source code for those who might be interested.
url = document.location.href;
re = /desktop_uri=(http%253A%252F%252Fwww.youtube.com)?%252Fwatch%253Fv%253D([^%25%26]+)(%25|%26)/;
if ( re.test( url ) ) {
location = 'http://youtube.com/watch?v=' + RegExp.$2;
} else {
alert( 'Unrecognized URL format' );
}
UPDATE 28 Feb 2010: new version, fixed regex bug.
UPDATE 08 Jul 2010: new version, improved regex for another case.
Tags: bookmarklet, javascript, youtube