Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For me I think the best UI for YT-DL would be in the context menu in Firefox.

This is where I am most often when I see stuff I want to use it on and while I always already have a terminal window open, it would be nice not to have to switch windows.

I already have a few different configs and aliases for getting stuff in the forms I really want. All I need is an even easier way to pass the URL in and trigger the download.

Being able to right click and get there would please slack me to no end.



Most solutions I've seen to this require some kind of external daemon to be running that takes care of launching ytdl for you (since most web browsers don't allow extensions to run arbitrary commands.)

Firefox _does_ have support for running this daemon-like-thing for you using Native messaging[0] though.

youtube-dl-firefox-addon[1] seems to employ this, so perhaps give that one a try?

[0] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...

[1] https://github.com/akhilkedia/youtube-dl-firefox-addon


Just my 2 cents:

I've been using a combination of firefox/chrome with youtube-dl/mpv+youtube-dl for a while

This comes very handy for playing high quality youtube videos on low end machines or downloading audio+/-video directly from youtube.

On the pre-webextension era of firefox/chrome , "open with" addon was the perfect fit.

Now, a special native messaging app needs to be installed to launch mpv/youtube-dl

"Open with" addon solved this by a python script (that obviously required installing python, and few other steps)

I decided to create a new tool to make this step easier and faster on windows: owclauncher[1]

Basically a lightweight native messaging host for "open with" addon: it is not running on the background, and only started (and immediatly terminated) by the browser when passing a command to any other program

You can check and compile the source code or the .bat windows installer/uninstaller

[1] https://github.com/mbooga/owclauncher


Hey wow! This is exactly the info I needed and it's for the platform I use.

Thanks!


I have this: a browser extension (and an Android share option), a web server to consume the URLs thus clicked/shared, a database to track state, and a cron job to actually launch the download. It's a bunch of ugly hacks, but I can just right-click or share a video, and have all the rest happen automagically.


I'd love to replicate what you've set up. The web server and from job doesn't sound too difficult, but I'm confused about the browser extension and Android share option. I'd be very grateful if you could elaborate further on that.

Thanks.


You have been warned ;) It is horrible - I slapped that together to scratch my itch and been planning to rewrite ever since. Perhaps now is the time. https://github.com/Piskvor/webfetchface

In essence, the core of the whole thing is a single SQLite table, with rows of URL+status (and some metadata).

The web interface lists these, and provides a form to insert more rows. There is no ACL, my instance is only secured by htaccess. (I have specifically chosen to use a web server, as I'm sharing the URLs from multiple devices, but I want to download them over my home link and save to my NAS.)

The cron job reads the table, fetches rows that are status=queued, calls yt-dl to download them, and updates their status accordingly (with some fallbacks and error handling).

There's some extra stuff - like using ffmpeg to make thumbnails - but the basic operation is extremely simple.

(Browser extension and Android sharing option do the exact same thing as the web interface: post the current URL through the web insert form. Those are optional, but allow me to add URLs without extra steps. The browser extension is installed unpacked, through developer options, and has the URL hard-coded. It works both in FF and Chrome. The Android share option is through https://play.google.com/store/apps/details?id=ch.rmy.android... , making a HTTP request directly - I'll add a README.)


Yup. Me too! Did someone make something like this?

The alternative I'm considering is a script for my WM that essentially does "CTRL+L, delay 500ms, CTRL+C, append to a rolling 'to yt-download' list file".


I did something like this a couple of months ago. I wrote a simple firefox extension which adds a button near the url bar which calls youtube-dl to download the current URL on a predefined folder. It needs an intermediate "helper" which is registered via the Windows registry (just make a key for it). All the helper does though is just call youtube-dl.

It sounds complicated but i had never written any firefox addon at all before trying it and it took me less than an hour to write the entire thing just by following the docs. The biggest change was switching from regular firefox to developer edition so i can disable signature checking for addons (the regular firefox doesn't allow that), but so far all that meant is that the red icon globe is now blue and i get more frequent updates.

None of that is available publicly though since it is very configuration-specific - and really all it does is to call 'youtube-dl' - but it is easy to replicate. Also learning to make some "personal" addons might be helpful in the future, similar to how you customize Emacs or Vim.


On firefox/chrome/opera for windows, you can do this easily with "open with" addon +/- owclauncher


I'm always weary about having timers in a script, because it often turns out to not be the correct amount. What about something like:

- bookmark url in a specific "YouTube-dl" folder

- watch tht folder from a daemon

- when the folder changes, do the stuff automatically

I'm sure there's a way to read bookmarks from outside the browser ?


I don't like timers either, but that seems to me the most direct way of exfiltrating the URL of the tab I'm currently looking at. Unfortunately, browsers aren't exactly interoperable.

Bookmarks don't seem that easy to exfil either. Firefox for instance (just checked) stores bookmarks, along with browsing and download history, in an sqlite database, that it keeps locked, so sqlite3 won't read from it. Maybe there's a way to force-read that database, but I haven't figured it out yet.

Here's an alternative idea I might actually go for: a systemd service[0] on my NAS in my home LAN that accepts links over the net and feeds them to youtube-dl. It could maintain a database of links already downloaded to avoid unnecessary redownloads. Then I could use an extension to simply send requests to an URL in my LAN.

My perfect UI would actually have this integrated with the Like button on YouTube. Click Like, it schedules a download. This is because there's plenty of videos that I wanted to get back to after few years, only to discover them gone (account banned, video removed, copyright bullshit, etc.).

--

[0] - Or something. There must be something in systemd that can be used to listen on a port, feed requests from it to a script, and reply with the output?


If you're going to go with Youtube's Like, you should be able to use the API (https://developers.google.com/youtube/v3/docs/videos/list, "my liked videos") and get the results you want there. The advantage of using Youtube's Like is that you can use any player from anywhere to do it.


This wasn't for youtube-dl, but a long time ago I used to have a somewhat similar system using a simple named pipe. Write the URL to that file, one URL per line; a simple ksh (back then :-) ) script read it on the other end and did its magic. The cool thing about it being that all you had to do was echo $url >> ~/.dl/queue.txt .


There is much direct and easier way to pass a link or the current page's URL to an external program using "open with" browser addon + owclauncher (https ://github.com/mbooga/owclauncher)


Didn't try this myself yet, but if you search FF extensions for 'invid' you'll find there are a bunch of extensions related to invidio.us which is like youtube + download button, and more. So there might be something to your taste there.


This level of integration is possible with another browser and normal youtube-dl: qutebrowser.


hmm for elinks i use a script i made.

xterm -e yourube-dl --restrict-filename -o "~/downloads/%(title)s.%(ext)s" -f "best[height<=?1080]" $1

the height means no bigger than 1080 but if 1080 does not exist go to the next best down. i have a virtual desktop(tiling manager) that my downloads download at visually like wget youtube-dl and thats why i use xterm -e keeps them out of the way and trying to draw ontop elinks. the terminal automatically closes when done.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: