Support for Youtube SSL/https
![]() ![]() |
as per: http://userscripts.org/topics/69990
First I tried modifying the includes - btw, I suggest using the ones from Download YouTube Videos as MP4:
// @include http://*.youtube.com/watch?* // @include https://*.youtube.com/watch?*instead of what is currently used: // @include http://www.youtube.com/*... but this didn't make it work. Then I tried changing 2 instances of http in the script to https instead, but didn't make it work either.
|
![]() ![]() |
Thanks. Userscripts.org is giving me a 404 error no matter where I click, so I will not be able to read your message for a while. Hope it's fixed soon. --3ICE (Just getting the system to send you this message took me like 10 tries.) |
![]() ![]() |
(Userscript.org is almost back to normal now.) Hi, I have added support for https. New includes:
// @include http://www.youtube.com/* // @include https://www.youtube.com/* New regexp failsafe:
if(!document.location.href.match(
/https?:\/\/[a-zA-Z\.]*youtube\.com\//)){return;}/https?:/ matches "http:" and "https:"
(Regexp will have to be updated again, replacing --3ICE p.s.: And if you can show me at least one youtube link where the part in front of ".youtube.com" is not "www", I will of course replace "www" with "*". (Few years ago they did use country specific subdomains, like "uk.youtube.com", "fr.youtube.com", but that is no more.) |
![]() ![]() |
Just tested new version of the script but my example url above wasn't cleaned. I have added support for https.Are you really sure it supports https?
or put in another way: did your update really change anything to the better in practise/reality? EDIT: tried replacing [a-zA-Z\.]* with www. as yeah if [a-zA-Z\.]* just is kinda like a placeholder like *, but meaning 3 characters (+.) then yes www. would seem to do it as well. Didn't make any difference - still doesn't work on https.
EDIT2: Also tried removing the regexp altogether as you suggest in the code (can be easily seen here fx) making the script run on all websites, but didn't better the situation either. if you can show me at least one youtube link where the part in front of ".youtube.com" is not "www", I will of course replace "www" with "*"Ah, you've got me (I can't show you one). I can see that. Though * works just as great as www.. Or potentially it "works better"/is better because it is prepared fx if they go back and use country specific subdomains as you mention.
I could understand if you were against having/adding an include like: // @include http://youtube.com/watch?*I'm against that as well. No point in doing that as it takes up an extra line/include and currently YouTube doesn't use this structure (have they ever?), they have decided to additionally use www. and that will get auto-added if you try a url without.
But actually that wasn't the main reason why I suggested the includes used by Download YouTube Videos as MP4. The main reason (apart from of course that it have an https include) is because it has watch? in it compared to yours. And I think it's better practice to be specific about the include instead of having sitewide ones. So can you show me a "polluted" YouTube link that ain't in the youtube.com/watch?-form?
Btw did you notice the Userscripts.org is giving me a 404 error (...)Yeah I had been getting LOTS of errors too earlier around when I created this topic. EDIT3: related or new script you think?: noticed when doing a YouTube search that the parameter &feature=grec_index &feature=topvideos_CATEGORY &feature=aso &feature=fvhlif you use the narrow include. Related to this are 2 things: 1) http://www.youtube.com/user/beyonceVEVO?feature=chclk won't be cleaned out - neither at the search page or when following the link. Neither will http://www.youtube.com/user/aliciakeys?blend=1&ob=5 - tried looking for those two parameters, only found this which didn't make me any wiser. I've seen blend= so far with these 1,4,6,7,8,9,10,23,24. I've seen ob= with 4,5 so far. As to - us users - what is it good for? Absolutely nothin'! it seems. Neither http://www.youtube.com/user/RihannaVEVO?feature=artistob is cleaned. And on this page neither is http://www.youtube.com/watch?v=HAfFfqiYLp0&feature=channel_video_title - it is though if you follow the link, but still...
2) the "destiny's child" related search suggestion link has the url: http://www.youtube.com/results?suggested_categories=10&search_query=destiny's+child&lclk=destiny's_child/d/st/0 - I think it should really just be like http://www.youtube.com/results?search_query=destiny's+child.
More: http://www.youtube.com/artist?a=GxdCwVVULXewLzmGzHQKeUHShvQYOHQH&feature=artistob isn't cleaned.
There's also http://www.youtube.com/shows and it doesn't clean the links totally: http://www.youtube.com/show/isitagoodideatomicrowavethis?feature=recent_shows. Also there's the ones of the form youtube.com/show?p= like http://www.youtube.com/show?p=AbxogaeOUEs, but they seems to get all cleaned - so does http://www.youtube.com/show/gma.
And the last thing I've found for now: YouTube - Google Instant with Bob Dylan has the link http://www.youtube.com/redirect?q=http://gawker.com/5633106/the-google-ad-steve-jobs-will-hate&event=as_seen_on_redirect&usg=JzZaIKzlt1BmDxi-jkaZtKAFkNg= when it should really just be http://gawker.com/5633106/the-google-ad-steve-jobs-will-hate. Similarly YouTube - Introducing Google Instant has the link http://www.youtube.com/redirect?q=http://www.google.com/instant&event=as_seen_on_redirect&usg=ACYuEp5tRd6Spv1_bn6kbNL0UrE= when it should really just be http://www.google.com/instant. In the same way YouTube - Kanye West - All Of The Lights ft. Rihanna, Kid Cudi has the link http://www.youtube.com/redirect?q=http://www.omg-facts.com/page/1&event=as_seen_on_redirect&usg=jPhZ7jtGeXIdiXdpkUN3G-P9jfY= that should just be http://www.omg-facts.com/page/1, BUT in addition this one also has the link http://www.youtube.com/artist?a=GxdCwVVULXd4aUDsb_CKDIl61iOFWAlF&feature=watch_metadata which should just have been http://www.youtube.com/artist?a=GxdCwVVULXd4aUDsb_CKDIl61iOFWAlF.
phew ''O.O'''! damn YouTube...! |
![]() ![]() |
The scope of my userscript is limited to cleaning video links that begin with "http://www.youtube.com/watch?v=" and only does this on pages that start with "http://www.youtube.com/". If I tried to keep up with all the user pages, playlists, search results, and redirects, then my script would turn into a bloat. Auto-playlists are destroyed by my script, but I'm okay with that. I have always used the "view_play_list" method you stumbled upon just now. If I add the "/watch?" part to includes, then the script would not run on youtube.com frontpage for example. I found the reason why my update didn't work. I forgot to test the isYouTubeLink function. What I missed was the As for all your other notes, they should definitely be turned into a new script. But someone else is going to have to write it. --3ICE |
![]() ![]() |
Well... no. No, it still won't work for HTTPS. Why? Yes, isYouTubeLink will correctly return true if on a YouTube site. However, cleanURL won't work because the position of the ? in the link is hardcoded. That's what regular expressions are for... I'll have a go at improving the script if you don't mind? Edit: Wow, I have a weird problem here. The onload handler never fires! I haven't even changed anything about that code. Any ideas? Edit2: Fixed that by changing the false in b.addEventListener("load", CleanURLs, false); to true. Anyway, all the links ranch2thedressing mentioned are now cleaned correctly. Please tell me, 3ICE, if I can release that! I'll leave your credit in it, of course. |
![]() ![]() |
Permission to fork my script granted to derula (in a private message). EDIT: Will link to your version on the main page when it's uploaded. Please send me a PM with the script ID once you published it. EDIT2: Thanks for reporting the hardcoded "?" issue in cleanURL, I fixed it. I am publishing version 3.333 in the next hour. Why a whole hour? Because I know I will get carried away while testing :) I also copied your fix for the addEventListener()s. I don't know why they worked before, but they stopped working for me too just now so the fix was very useful. Thank you. |



