QuiteRSS / quiterss

Free news feeds reader
https://quiterss.org
Other
1.01k stars 123 forks source link

[Request] Separate "open with" option #1280

Open Bzzz opened 4 years ago

Bzzz commented 4 years ago

Hi, quick suggestion based on my use of QuiteRSS: I'm downloading all of the stuff from my Youtube feeds via youtube-dl for performance reasons (C2D CPU). Currently I copy the video URL and paste it into some shell, about five to ten videos per day. Wouldn't it be nice to have a second "open with" option that can be redirected to youtube-dl? I could imagine other folks might want to open certain links with a different browser than the system standard (or custom defined) one, so that'll work with such an option as well.

senseiski commented 4 years ago

Customisable open with option would be great. In the meantime you could use a shell script to use ytdl as an external browser? The problem is if you actually would want to use a proper external browser as well.

Bzzz commented 4 years ago

Thanks for reminding me to fix that myself outside of QRSS - here's a quick attempt:

!/bin/bash

urlsubstr='youtube' for i; do if grep -q "$urlsubstr" <<< "$i"; then youtube-dl "$i" else firefox "$i" fi done

This executable bash file is then used as external browser in QRSS. So if the clicked URL matches the search term, it's redirected to youtube-dl, otherwise it'll go to firefox as usual (opening links however cannot be seen in the task bar, but that's a small price to pay) youtube-dl handles the rest per defaults (~/.config/youtube-dl.conf), e.g.

-f bestvideo[height<=?1080][vcodec!=vp9]+bestaudio[ext=m4a]/best[ext=m4a]/best -o '/my/download/folder/%(duration)05d - %(title)s - %(id)s.%(ext)s' --default-search "ytsearch"

It's probably a bad idea to click video links again while downloading due to the second one skipping the video download, finishing audio first and then trying an unsuccessful merge of the source files, but again - that's a small price to pay for the convenience.

senseiski commented 4 years ago

Tried your script and it works great. Thanks! Do you think it can be extended to open embedded youtube videos from other feeds?

Bzzz commented 4 years ago

As in e.g. news posts that embed video? Probably, I'd need an example feed to test that. Note that the tiny script probably mishandles speaking URLs that contain "youtube", so a longer search term might be a good thing to have.

senseiski commented 4 years ago

This one for example has embeds: https://www.iwm.at/feed

Bzzz commented 4 years ago

Well yeah, it does - https://www.iwm.at/closedbutacitve/weekly-focus/kommunitarismus/nancy-frasercrisis-critique-capitalism-a-framework-for-the-21st-century/ for example does have an embedded video at the start, and right-clicking onto the video and hitting "Open Link" causes it to be parsed by the external browser script. Please try that yourself.

senseiski commented 4 years ago

Ah it does! Thanks!