by apetresc · 9y ago · 0 comments
Now that Mozilla is promising to open-source this, I eagerly await adding this feature to my own fork :)
Ingredients:
1. Termux App.
2. Termux API App.
3. Termux CLI utilities. apt install termux-api
4. Python: apt install python
5. youtube-dl: pip install youtube-dl
6. VLC App. Install from app store.
7. A set of shell functions for clipboard and application access:
alias xc='termux-clipboard-set'
alias xp='termux-clipboard-get'
open ()
{
termux-share "$@"
}
I'll generally download videos to the Download folder, which I've symlinked from the Termux home directory: lrwxrwxrwx 1 u0_a204 u0_a204 29 Apr 26 2016 Download -> /storage/emulated/0/Download/
Oh, and how did I get those functions and aliases? (alias | egrep x[cp]; typeset -f open) | sed s/^/ / | xc
(Pre-formatted for HN's code block.)With all of that, you can download and play, in one swell foop, a video (assuming you know the output format you prefer -- something you can set as a youtube-dl preference):
open $( youtube-dl -f 18 "$(xp)" | awk -F':' '/Destination/ {print $2}' )
Or you can fetcha whole slew of content and queue it up on VLC.I'd still prefer to be able to use a commandline audio player with controls rather than the GUI client. There's a very simple "play-audio" command, but it has no controls -- <ctrl>-C to end is about it, even backgrounding doesn't actually stop playback.
I've messed with the sox "play" command, but it doesn't have an assigned audio device, and I've been unable to convince it that such a thing exists (see StackExchange posts regarding Android for similar issues/discussions).
Then install youtube-dl as follows:
$ brew install youtube-dl
And download videos as follows: $ youtube-dl "https://www.youtube.com/watch?v=dQw4w9WgXcQ"The browser is such an obviously poor place to stick A/V. Other than, of course, the fact that advertisers slobber over cramming every more crap down some "channel" or other.
Thank god there's a native iOS/Android client.
BTW, I'm unable to access /storage/emulated/0, it seems Termux doesnt have permission (and the app doesnt list it in its permissions). Is your phone rooted?
I've just confirmed though that I can create and delete files on /storage/emulated/0/ YMMV, is all I can say.
I wish we had these options in Canada, because mobile bandwidth is stupidly expensive over here.
This is because Internet in India sucks
> available in the United States, Australia, Mexico, New Zealand and South Korea.
And anyway, despite the name, youtube-dl supports a whole lot more than just YouTube.
[1]: reminder: technically, streaming isn't different from download, what your computer does when watching a video in streaming is downloading. Forcing users to delete the video they have downloaded (which is exactly what's happening with streaming) so they pay the premium service for off-line use, is not a legitimate way to do business. They can do it of course, if people are willing to pay for something they can have for free it's fine, but people who don't want to pay aren't doing anything wrong.