XTube - Video Download Link

By Signe Last update Feb 17, 2011 — Installed 25,117 times.

not working?

in
Subscribe to not working? 18 posts, 7 voices



Bryann User

I don't see the download link anywhere. Yes, I read the 'about' section before installing. Did xtube chagne their site again? please update!

 
lovetoloveyo... User

It broke sometime last night! :-(

 
Bryann User

Thanks for the reply. I really hope G. Monkey (the author) updates this again. Would be so valuable to have! I installed this right after they changed their site again, apparently, so never got to test it. :(

 
lovetoloveyo... User

It was a really great script, too. I'm with you in hoping G. Monkey comes to our rescue!

 
Signe Script's Author

It's been updated to address the issue. I don't generally download many clips, so I hadn't noticed the breakage.

 
lovetoloveyo... User

Sadly, another break! :X

 
lovetoloveyo... User

I miss this script very much! :(

 
mstram24 User

what causes scripts to stop working? when webdesigners at targetsites , like xtube, change something in their page?

 
Signe Script's Author

I can still verify it as working. The only thing that changed was the name of the page.

Update the script, or modify your included pages to be:
http://v*.xtube.com/watch_video.php?*

Instead of:
http://v*.xtube.com/watch.php?*

 
Signe Script's Author

Sorry, make that "add" not replace.

 
mclitening User

it still didnt work itsays web page not found soooo

 
Signe Script's Author

Provide more details, maybe? What says page not found?

I tested it on several dozen different pages yesterday, and each one worked perfectly.

 
adrogynous_a... User

I have both the watch_video.php AND watch.php it's still not showing up next to add to favorite or comments. Is there a new fix I'm not finding?

 
Signe Script's Author

This script doesn't put the link near favorite or comments. It puts the link next to the title of the video, above the video. "Download this video"

 
skipmartin User
FirefoxWindows

Doesn't work for me... what should I do?

 
skipmartin User
FirefoxWindows

Got it to work, here it is with my edits:


// ==UserScript==
// @name XTube - Video Download Link
// @namespace http://www.cothlamadh.net/greasemonkey
// @author Signe - http://www.cothlamadh.net/
// @description Modify the video page to include a link to download the video to your desktop. This is a completely rewritten and optimized version of a script originally by Lorax
// @include http://v*.xtube.com/watch_video.php?*
// @include http://v*.xtube.com/watch.php?*
// ==/UserScript==

String.prototype.getPref = function(s, splitter) {
return this.split(s+"=")[1].split((splitter||"&"))[0];
};

function genDownloadLink() {
var url = window.location.search.substring(1);

// All of the query parameters we need are part of the watch.php page we're already viewing
var whos = url.getPref('v_user_id');
var vix = url.getPref('idx');
var vidid = url.getPref('v');
var clid = url.getPref('cl');

// Build the search URL
var searchUrl = "http://video2.xtube.com/find_video.php?sid=0&v_user_id=" + whos + "&idx=" + vix + "&from=&video_id=" + vidid + "&clip_id=" + clid + "&qid=&qid=&qidx=&qnum=";
// Make the search request and then update the document with a link to the video
GM_xmlhttpRequest({
method: 'GET',
url: searchUrl,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
},
onload: function(responseDetails) {
/**
* From output that looks like this:
* &filename=/videos/2008/20080911pm/5721S4Jd0EB.flv&clip_id=7aX3d-S721-&status=1&preview_type=0&preview_video_id=&preview_clip_id=
* We're taking the filename= portion.
*/
var flvPath = responseDetails.responseText.split('&')[1].split('=')[1];
// Locate the servername specified in the document
var cdnReg = /cdn\d+\.xtube\.com\/e12/;
var cdnSrv = cdnReg.exec(document.body.innerHTML);
var theServer = cdnSrv[0].replace("e12","e13");

/**
* Modify the video's title to include a download link
*/
// Locate the h2, add two non-breaking spaces
var anchorExpr = document.createExpression('//td/h2', null);
var h2 = anchorExpr.evaluate(document, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);
h2.innerHTML += '  ';

// Create a new span and add the opening paren for the link we're about to add
var newSpan = document.createElement('span');
newSpan.innerHTML = '(';

// Create a new link and set the path and text
var newAnchor = document.createElement('a');
newAnchor.href = 'http://' + theServer + flvPath;
newAnchor.innerHTML = 'Download this video';

// Add the link to the span and then add the closing paren
newSpan.appendChild(newAnchor);
newSpan.innerHTML += ')';

// Finally add the span to the h2
h2.appendChild(newSpan);

/* and thats that! */
}
});
}

genDownloadLink();

 
Signe Script's Author
FirefoxWindows

Maybe you could detail the edits instead of posting the whole script? As should be evident, I'm pretty proactive about fixing it.

 
Signe Script's Author
FirefoxWindows

Updated - tested to be working. Not the same code posted by skipmartin.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel