Clarified each option, added a just youtube-dl option, added Usage section

Improved the index and wording in general
This commit is contained in:
Marco D'Agostini 2020-06-14 20:07:31 -05:00
parent 7a23ffdda2
commit 96dc4b1321

View File

@ -1,61 +1,27 @@
[//]: # "Ctrl+K,V o Ctrl+Shift+V - Para ver vista previa en VSCode" [//]: # "Ctrl+K,V o Ctrl+Shift+V - Para ver vista previa en VSCode"
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. Tutorial to install [youtube-dl](https://github.com/ytdl-org/youtube-dl/) in android via [termux](https://termux.com/), and configure it to download links shared from another app.
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/* *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) # Usage
2. [Extras](#Extras)
3. [All-In-One](#All-In-One) Click **Share**, select **Termux**, choose video or audio, and that's it!, it will be saved to `Downloads/{Provider}/` e.g `Downloads/Youtube/`
# Install Termux # Install Termux
https://termux.com/ https://termux.com/
# Open Termux and run one of these: # Open Termux and run one of these:
## All-In-One 1. [Youtube-dl + sharing + dialog **(Recommended)**](#Youtube-dl-+-sharing-+-dialog-**(Recommended)**)
2. [Youtube-dl + sharing](#Youtube-dl-+-sharing)
3. [Youtube-dl](#Youtube-dl)
4. [Termux extras](#Termux-extras)
5. [All-In-One](#All-In-One)
Youtube-dl + Termux extras ## Youtube-dl + sharing + dialog **(Recommended)**
```bash After sharing to termux, a dialog will appear so you can choose to download video or just audio
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 ```bash
# Ask for storage permission # Ask for storage permission
@ -92,7 +58,9 @@ Youtube-dl + Termux extras
chmod +x ~/bin/termux-url-opener chmod +x ~/bin/termux-url-opener
``` ```
## Youtube-dl (only video) ## Youtube-dl + sharing
This will always download video. But if you always want just audio, replace `youtube-dl $url` with `youtube-dl -x $url`
```bash ```bash
# Ask for storage permission # Ask for storage permission
@ -111,7 +79,17 @@ Youtube-dl + Termux extras
chmod +x ~/bin/termux-url-opener chmod +x ~/bin/termux-url-opener
``` ```
If you only want audio, replace `youtube-dl $url` with `youtube-dl -x $url` ## Youtube-dl
This will only install youtube-dl in termux, you need to run it manually from the terminal, e.g `youtube-dl https://youtu.be/blahblahblah`
```bash
# Ask for storage permission
termux-setup-storage &&
# Install youtube-dl
apt update && apt upgrade && apt install python ffmpeg && pip install youtube-dl
```
## Termux extras ## Termux extras
@ -126,3 +104,43 @@ If you only want audio, replace `youtube-dl $url` with `youtube-dl -x $url`
# Install nano # Install nano
apt install nano apt install nano
``` ```
## All-In-One
Youtube-dl + sharing + dialog + 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
```