Support for Youtube SSL/https

in
Subscribe to Support for Youtube SSL/https 7 posts, 3 voices



ranch2thedre... User
FirefoxWindows

as per: http://userscripts.org/topics/69990
could support for SSL/https be included?

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.

Example: https://www.youtube.com/watch?v=1rnfE4eo1bY&pla...

 
3ICE Script's Author
ChromeWindows

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.)

 
3ICE Script's Author
ChromeWindows

(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 [a-zA-Z\.]* with www..)

--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.)

 
ranch2thedre... User
FirefoxWindows

Just tested new version of the script but my example url above wasn't cleaned. http still works though. I've tested with newest version of Greasemonkey on AMO (0.9.2), with Scriptish version 0.1b9 which is the newest ("preliminarily") reviewed Scriptish on AMO and version 1.0 of Scriptish on GitHub (have not tested Scriptish version 1.0 from AMO, but it seems like it's older than the one on GitHub so...).
So as per this statement of yours:

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 &list=UL-part I had added to my example url? you could add that to your list you're maintaining...

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 &aq=f gets added to the url. I searched on Google but found no documentation on it. I investigated a little further on YouTube and it seems it might have something to do with the Autocomplete/suggest function. If you choose suggestion 1 the parameter &aq=0 will be added to the url. So from 0-9. I guess f in &aq=f probably stands for false. The a might stand for autocomplete and q for query, or what do you say? I'd be interested if you had a better suggestion. I'm curios as to the shortening and info behind the parameter.
Could you add to the script the function to keep YouTube's search function from adding these "polluting" parameters?
EDIT4: I realize now requesting this function to the script give me a "polluted" YouTube link that ain't in the youtube.com/watch?-form. It would be in the youtube.com/results?-form?
Also I now realize from another case I've found that if using just the more narrow youtube.com/watch?-form as the include then it won't clean out the &feature=fvst-parameter in the 'Featured Videos'-video links (example (screenshot) - in this case fx the 2nd link "Beyoncé - Ego (Remix) ft. Kanye West" will link to http://www.youtube.com/watch?v=iW5EzxFR4SM&feature=fvst). I've collected, a list of searches that may give you this gray 'Featured Videos' block, by using YouTube's related search suggestions (what I call the bar with 9 suggestions in the previous screenshot. It can also have 10 though).
Playlist links won't be cleaned either if you have the narrow include: http://www.youtube.com/watch?v=kJFscLngknY&playnext=1&list=PL3BFF255D66A5F7C6. Maybe this script is too rigid/tough in this playlist example though. Wouldn't it be better if the image to the left of the playlist and the title link of the playlist linked to the playlist like: http://www.youtube.com/playlist?p=3BFF255D66A5F7C6 or just kept unchanged (http://www.youtube.com/watch?v=kJFscLngknY&playnext=1&list=PL3BFF255D66A5F7C6) and then the 3 (or 2 or 1. I think 3 is max and also most dominant) links to the right of the image would be cleaned to be just the links of the videos. Don't know if that's possible though.
EDIT5: just stumbled upon another way for playlist url: http://www.youtube.com/view_play_list?p=3BFF255D66A5F7C6 - I think I like the first and shorter one better though.
+ doh not to forget the frontpage which gives you:

&feature=grec_index
&feature=topvideos_CATEGORY
&feature=aso
&feature=fvhl
if 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...!

 
3ICE Script's Author
ChromeWindows

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 or (s.substr(0,29)=="https://www.youtube.com/watch?") line's second number. It should have been 30 instead of 29 because of the added "s" character: or (s.substr(0,30)=="https://www.youtube.com/watch?")

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

 
derula Scriptwright
FirefoxX11

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.

 
3ICE Script's Author
ChromeWindows

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.