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.

  • Morgikan@lemm.ee
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 year ago

    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.

    • Daniel QuinnOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      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.

      • Morgikan@lemm.ee
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        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.

        • Daniel QuinnOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year 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.