From 7a23ffdda2e5d08d1ea40427ca4d0ead2c737a0a Mon Sep 17 00:00:00 2001 From: Marco D'Agostini Date: Sun, 14 Jun 2020 18:47:04 -0500 Subject: [PATCH] Reorganized options --- install youtube-dl in android.md | 91 +++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 25 deletions(-) diff --git a/install youtube-dl in android.md b/install youtube-dl in android.md index 72266d4..5dd195f 100644 --- a/install youtube-dl in android.md +++ b/install youtube-dl in android.md @@ -2,6 +2,8 @@ Tutorial to fast install [youtube-dl](https://github.com/ytdl-org/youtube-dl/) in android and configure it to download any url shared to it. +For example, Youtube's videos will be downloaded to `Downloads/Youtube/` + *Based on https://www.reddit.com/r/Piracy/comments/baufql/youtubedl_the_easy_way_on_android/* 1. [Install and configure youtube-dl](#Install-and-configure-youtube-dl) @@ -13,7 +15,47 @@ https://termux.com/ # Open Termux and run one of these: -## Install and configure youtube-dl +## All-In-One + +Youtube-dl + Termux extras + +```bash + termux-setup-storage && + apt update && apt upgrade && apt install nano python ffmpeg && pip install youtube-dl && + mkdir -p ~/.config/youtube-dl && + echo "# Default Output Directory and Pattern + -o /data/data/com.termux/files/home/storage/downloads/%(extractor_key)s/%(title).150s-%(id)s.%(ext)s" > ~/.config/youtube-dl/config && + mkdir ~/bin && + echo '#!/bin/bash + URL=$1 + HEIGHT=15 + WIDTH=40 + CHOICE_HEIGHT=4 + + CHOICE=$(dialog \ + --menu "Que desea descargar?" \ + $HEIGHT $WIDTH $CHOICE_HEIGHT \ + Video "" \ + Audio "" \ + 2>&1 >/dev/tty) + + case $CHOICE in + Video) + youtube-dl $URL + ;; + Audio) + youtube-dl -x $URL + ;; + esac' > ~/bin/termux-url-opener && + chmod +x ~/bin/termux-url-opener && + mkdir ~/.termux && + echo "extra-keys = [ \ + ['ESC', '/', '|', 'HOME', 'UP', 'END', 'PGUP', '-'], \ + ['TAB','CTRL', 'ALT', 'LEFT', 'DOWN', 'RIGHT', 'PGDN', '~'] \ + ]" > ~/.termux/termux.properties +``` + +## Youtube-dl ```bash # Ask for storage permission @@ -50,7 +92,28 @@ https://termux.com/ chmod +x ~/bin/termux-url-opener ``` -## Extras +## Youtube-dl (only video) + +```bash + # Ask for storage permission + termux-setup-storage && + # Install youtube-dl + apt update && apt upgrade && apt install python ffmpeg && pip install youtube-dl && + # Configure to download videos in `Downloads/{URL's provider (e.g. Youtube)}/{filename}` + mkdir -p ~/.config/youtube-dl && + echo "# Default Output Directory and Pattern + -o /data/data/com.termux/files/home/storage/downloads/%(extractor_key)s/%(title).150s-%(id)s.%(ext)s" > ~/.config/youtube-dl/config && + # Configure to open shared URLs with `youtube-dl {url}` + mkdir ~/bin && + echo "#!/bin/bash + url=$1 + youtube-dl $url" > ~/bin/termux-url-opener && + chmod +x ~/bin/termux-url-opener +``` + +If you only want audio, replace `youtube-dl $url` with `youtube-dl -x $url` + +## Termux extras ```bash # Add special keys to keyboard @@ -62,26 +125,4 @@ https://termux.com/ ]" > ~/.termux/termux.properties # Install nano apt install nano -``` - -## All-In-One - -youtube-dl + extras - -```bash - termux-setup-storage && - apt update && apt upgrade && apt install nano python ffmpeg && pip install youtube-dl && - mkdir -p ~/.config/youtube-dl && - echo "# Default Output Directory and Pattern - -o /data/data/com.termux/files/home/storage/downloads/%(extractor_key)s/%(uploader)s/%(title)s-%(id)s.%(ext)s" > ~/.config/youtube-dl/config && - mkdir ~/bin && - echo "#!/bin/bash - url=$1 - youtube-dl $url" > ~/bin/termux-url-opener && - chmod +x ~/bin/termux-url-opener && - mkdir ~/.termux && - echo "extra-keys = [ \ - ['ESC', '/', '|', 'HOME', 'UP', 'END', 'PGUP', '-'], \ - ['TAB','CTRL', 'ALT', 'LEFT', 'DOWN', 'RIGHT', 'PGDN', '~'] \ - ]" > ~/.termux/termux.properties -``` +``` \ No newline at end of file