this post was submitted on 13 Oct 2023
195 points (99.5% liked)

Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ

53370 readers
665 users here now

⚓ Dedicated to the discussion of digital piracy, including ethical problems and legal advancements.

Rules • Full Version

1. Posts must be related to the discussion of digital piracy

2. Don't request invites, trade, sell, or self-promote

3. Don't request or link to specific pirated titles, including DMs

4. Don't submit low-quality posts, be entitled, or harass others



Loot, Pillage, & Plunder


💰 Please help cover server costs.

Ko-FiLiberapay


founded 1 year ago
MODERATORS
 

The other day someone was complaining about the new ad blocker-blocker on YouTube and I mentioned that it might be fun to write a Firefox extension that would just load up yt-dlp and play the video through mpv.

It turns out, writing a Firefox extension is easy and tricking Firefox into launching yt-dlp isn't much harder (though it does require some annoying configuration on the user's end).

Anyway, if you're a Linux user, feel free to try it out. I don't know how much I'm going to pour into this, but as an exercise of "can this be done", it was pretty good for a few hours on a Friday night.

all 19 comments
sorted by: hot top controversial new old
[–] MonkCanatella 10 points 10 months ago

This is sweet, this exact same idea has been kicking around my head for awhile but I've never taken the initiative.

I did write a script (powershell lol), that uses yt-dlp to download all your subscription videos as they come in and sends a notification. Could easily be modified to work on linux and use ntfy or another notification service. ALso no need to scrape your subscriptions as it stays in sync with your currently subscribed channels.

[–] [email protected] 9 points 10 months ago* (last edited 10 months ago) (3 children)

can you please share a video of how it looks like when implemented. I think it is already possible to watch videos using VLC ?

[–] [email protected] 6 points 10 months ago

I've had a couple videos that wouldn't load properly in VLC. Rare, but it happens. Alternatives are always welcome.

[–] [email protected] 4 points 10 months ago

I don't think I have it in me to put together a video, but I can describe it if you like.

Once you install the extension and follow the setup instructions, you just go to a YouTube page. The extension adds an ugly button to the top-left of the page that says "bypass". When you click it, Firefox launches yt-dlp [the URL you're at] -o - | mpv - which basically just downloads the video and streams the output through the mpv video player. So now you're watching just the video, with no web page necessary.

[–] [email protected] 2 points 10 months ago

My best guess would be that the internal player of Firefox comes to play here.

You can try opening any MP4 with Firefox

[–] [email protected] 9 points 10 months ago (1 children)

Thank you for your work, but why not just use ff2mpv?

[–] [email protected] 13 points 10 months ago

Honestly, because I didn't know (a) that ff2mpv even existed, or that (b) mpv could play YouTube URLs directly. So thanks! I learnt two things today :-)

It was still a fun project though 'cause I learnt how to write a Firefox extension and get the browser to launch programs on-click, so not a waste of time!

[–] [email protected] 8 points 10 months ago

You are the best.

[–] [email protected] 6 points 10 months ago (1 children)

I was curious how you implemented this as it's pretty much the default YT bypass qutebrowser users use. Then I read the MIME type addition you did and had a good laugh. That's clever. Always nice to see a fellow Go user, too.

[–] [email protected] 2 points 10 months ago (1 children)

Is there another way to do this? This hack was the only way I could figure out how to get Firefox to invoke an external binary, but if there's a more conventional way to do it, I'd like to know 'cause I have another more complicated project in need of a pattern much like this one.

[–] [email protected] 3 points 10 months ago (1 children)

No, the way you did it is the only way I can think you can. Otherwise it opens up things to arbitrary code execution. I'm not exactly sure how qutebrowser gets away with it, but I know it's built on QT so maybe it just isn't running sandboxed or had some special method for calling external binaries/scripts. You might take a look at that project and see, but Firefox/qutebrowser is probably like comparing apples and oranges.

[–] [email protected] 2 points 10 months ago

That's actually very helpful, thanks. I've been working on another project to open certain URLs in specific browsers/profiles, and wanted to be sure that I wasn't missing a more obvious design pattern. The project is here if you're curious.

[–] [email protected] 4 points 10 months ago (1 children)
[–] [email protected] 3 points 10 months ago
[–] [email protected] 3 points 10 months ago

Awesome! Thanks!

[–] [email protected] 1 points 10 months ago

Great username, btw.

[–] [email protected] 1 points 8 months ago (1 children)
[–] [email protected] 1 points 8 months ago

It's a powerful video player in Linuxland.