Youtube to Invidious

Scan page for Youtube embeds and urls and replace with Invidious.

< Feedback on Youtube to Invidious

Review: Good - script works

Deleted user 128
§
Posted: 2019-05-18
Edited: 2019-08-05

Works nicely but encounters an issue here [RESOLVED]

Works nicely but it won't handle a YouTube embedded video at:

https://www.amsterdam-dam.com/webcam.html

Am I missing something, can anyone confirm my experience on that site?

OdinBroodAuthor
§
Posted: 2019-05-19

Yea I can confirm this. I can explain why this doesn't work and why it probably never will. This script checks for iframes that have a youtube url as source. If you inspect the page element you can see that for some reason this website uses a url shortener for their iframe source (https://tinyurl.com/y6ozddqd). I don't know why anyone would ever do that but I apparently that's a thing lol...

The reason that I will probably never get this to work with this script is because I simply cannot afford to follow every link-shortened url to check if there is a youtube video behind it. That would ruin the performance of this script and will have the negative side-effect that your browser will ping every link-shortened url it encounters on the web, that's a privacy issue.

There is only one type of indirect url that the script can deal with and that's the kind that puts the actual youtube link in its subdirectory. E.g like this: http://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKGEekP1102g (embedly is commonly used for this).

One last thing: "Het enige goeie wat er uit Amsterdam komt, dat is de trein naar Eindhoven!"

Deleted user 128
§
Posted: 2019-05-19

"[...]this website uses a url shortener for their iframe source"

OK, I should have figured that out when noticing the url shortener displayed in uBlock Origin. Indeed, odd way of proceeding. Maybe does the site just use the shortener as a counter? No idea but weird.

Nice joke about Amsterdam :=) Side-note and for a Sunday morning's smile : I've lived there three years in the eighties and having a view on Amsterdam's Dam recalls lovely memories :=)

Thanks for the script, well carried-out. And now I know the because of the why!

OdinBroodAuthor
§
Posted: 2019-07-28
Edited: 2019-07-30

Hey I looked at this problem again and found a way to fix it. It fetches the url behind the shortened url, without making a connection.

Deleted user 128
§
Posted: 2019-08-04

Latest Youtube to Invidious 8.1 does it! Beautiful, nice work :)

Just one thing : is there any way to have your script handle my bookmarks, those linking of course to a YouTube video? In fact my wish is to redirect ALL connections to YouTube (videos or not) EXCEPT when issued from either an Invidious instance (as the script does it) either YouTube itself ...

That's not an issue, script's concept is handled perfectly, only a wish...

Deleted user 128
§
Posted: 2019-08-04
Edited: 2019-08-04

I forgot to mention this :smile:

You write "It is recommended to block all Youtube domains while using this script (e.g with uBlock Origin or uMatrix)."

OK, so I'i've removed the following rule from uBO: * youtube.com * noop

1- Sites using YouTube thumbnails will require access to img.youtube.com So I've added this rule to uBO: * img.youtube.com * noop

A page such as this one will display its YT thumbnails accordingly. Fine.

2- Unfortunately some very few sites won't run the YT embedded video without access to youtube.com, i.e. this deeply nested video.

In this latter case I wish to ask you: does allowing a site to access youtube.com prevent your script (or whatever good redirector) from redirecting to the user's Invidious instance in true proxy mode?

Thanks and sorry for such a lengthy comment!

OdinBroodAuthor
§
Posted: 2019-08-05
Edited: 2019-08-05

You are true on both the points you make. Firstly, I will make it so images are proxied too, so you don't need * img.youtube.com * noop anymore (version 8.2).

For the second issue I have yet to find a permanent solution. Some websites do weird things where they require a call to Youtube to spawn an embed (like your example). The call is thisone 'https://www.youtube.com/iframe_api'. The script that is served by that url may be a clue to this problem.

I may look into redirecting all connections, but it's not really what I wanted this script to become. Personally I still want to be able to visit Youtube via the address bar which that feature would prevent (with js I cannot differentiate where connections originated from e.g. bookmarks, address bar, mail client, Discord etc).

Regarding your last question, I'm not sure what you mean. The script functionality is not impacted by blocking or allowing Youtube domains, I just recommend blocking to prevent any call leaks.

Deleted user 128
§
Posted: 2019-08-05
Edited: 2019-08-05

Version 8.2 resolves indeed the thumbnail problematic, no need for * img.youtube.com * noop which I've removed.

YouTube's iframapi_ is the culprit for sites using it, OK, culprit in that it requires the site to have access to youtube.com. OK.

I have not restored * youtube.com * noop but rather allow per site access, such as: article.wn.com youtube.com * noop for above example. www.jango.com youtube.com * noop another one ...

Redirecting all YT connections is indeed beyond the script's very concept and remains a user's approach. What I've done here is to add a rule to my Firefox Redirector extension:

REDIRECT - www.youtube.com TO invidious.snopyta.org
Redirect: https://www.youtube.com/* to: https://invidious.snopyta.org/$1
Example: https://www.youtube.com/TEST → https://invidious.snopyta.org/TEST
Applies to: Main window (address bar)

Because invidious.snopyta.org is the Invidious instance I refer to. Be noted that it is imperative to apply this redirection to Main window (address bar) ONLY otherwise it would interfere with your (our!) script.

Lastly, for my last above question, you did understand correctly when you answered,

I just recommend blocking to prevent any call leaks.

What I had, have in mind is the very call leak probability when allowing a site to connect to youtube.com besides the fact the call is of course intercepted and processed correctly by your script.

Thanks for this great userscript. I've tried them all I guess as well as dedicated Firefox estensions, YouTube to Invidious is the best, the most complete, IMO of course.

Have a nice week B)

OdinBroodAuthor
§
Posted: 2019-08-05

I am running uBO with the same rules indeed, I think that's the best approach. And for your needs the redirector works elegantly as well.

To facilitate my use-case (and hopefully others), I have added a 'watch on Invidious' button to all Youtube video pages (v8.3). It's not aggressive like immediate redirection and Invidious is still only 1 click away. Ideal middle-ground for me atm.

Deleted user 128
§
Posted: 2019-08-11
Edited: 2019-08-11

Hi OdinBrood,

As you mentioned above, you've added to ver. 8.2, proxied images as well, so you don't need * img.youtube.com * noop anymore (version 8.2).

That works fine, no problem. I'm back to ask you if you could include as well ytimg.com because some sites get their thumbnails from that server, i.e. HookTube. HookTube will display the videos via Invidious but gets its thumbnails from ytimg.com ...

hartelijk dank ;)

OdinBroodAuthor
§
Posted: 2019-08-11

Fixed :#

Deleted user 128
§
Posted: 2019-08-11

Great! Invidious on its own, all the way :)

Post reply

Sign in to post a reply.