YouTube stop video download
|
|
re: http://userscripts.org/scripts/show/7917 When youtube streams a video to its default player, it does a redirect from the http://youtube.com/get_video?video_id= location to something like http://chi-v217.chi.youtube.com which then streams the video data. You can use the same-domain restrictions of javascript to stop before it redirects and get the redirection address from the headers (there's also an extra redirect when the video is from cache.googlevideo.com). You can then add this address to a simple embed code and then use another remotely hosted flash player that supports buffering with autostart disabled. One strange thing I noticed is that for some reason the normal non-GM xmlhttprequest still allows cross-domain GET's when you use it in greasemonkey. I've used jQuery as a temporary solution. I'm not really sure why using jQuery enforces the same-domain restriction. Here's my code (it probably needs a bit of polishing :-) http://pastebin.ca/751901 |
|
|
for some reason the normal non-GM xmlhttprequest still allows cross-domain GET Maybe it's actually the same as the GM method (maybe GM_ is a convenience name); and it's a chrome-privileged XMLHttpRequest object: http://wiki.greasespot.net/GM_xmlhttpRequest I was thinking about youtube the other day, but after seeing how bad the quality of the videos were I figured it wasn't worth the hassle, think I found the URL and the video in the cache but don't have an FLV player. But I was wondering - will the script still work if I don't have the Flash plugin? The ones I viewed loaded a swf file, which would contain the URL of the actual movie, and load it when you clicked on the plugin's "Play" button. So how could Greasemonkey intercept the request which isn't anywhere in the DOM? I just wanted to save the movie and watch it offline. |
|
|
Maybe it's actually the same as the GM method (maybe GM_ is a convenience name); and it's a chrome-privileged XMLHttpRequest object: http://wiki.greasespot.net/GM_xmlhttpRequest Could be. I tried "new unsafeWindow.XMLHttpRequest();" , but that gave me an error, so I tried "new window.wrappedJSObject.XMLHttpRequest();" which didn't give me an error, but also didn't seem to restrict the request to the same domain. I've posted a question to the greasemonkey google groups, so hopefully someone has the answer: http://groups.google.com/group/greasemonkey-use... |
|
|
great idea, I'll try it, thanks :-) |
|
|
Hi, thanks for this Snippet. Did you realize a working script? I think, we need 2 more things:
|
|
|
Hi, thanks for this Snippet. Did you realize a working script?I think, we need 2 more things:- a Play-Button- a progress bar |
|
|
Hi, tried your script but I keep getting uncaught "exception: Permission denied to call method XMLHttpRequest.open". is there something I am missing? Thanks. |
