Skip to content

Instantly share code, notes, and snippets.

@cyrillkuettel
Last active April 23, 2024 16:00
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyrillkuettel/d63785cf5f4c00106ae215188c377515 to your computer and use it in GitHub Desktop.
Save cyrillkuettel/d63785cf5f4c00106ae215188c377515 to your computer and use it in GitHub Desktop.

yt-dlp termux full installation guide.md

Prepare

  1. Install Termux from Github: https://github.com/termux/termux-app/releases
  2. Download the apk and install it -> Note that installing termux from Play Store is highly discouraged.

In Termux:

pkg update
pkg upgrade

pkg install python

pip install --upgrade pip

Install yt-dlp (originated from youtube-dl)

# let's allow termux to access the phone's storage, it will ease our workflow:
pkg install termux-api
termux-setup-storage 

More info why this is needed here https://wiki.termux.com/wiki/Termux-setup-storage

This simlinks ~/storage to the default home directory.

# yt-dlp action Now we can download videos and music using yt-dlp. LIke

cd  ~/storage/downloads # note: this points to /storage/emulated/0/Download

# yt-dlp depends on ffmpeg
pkg install ffmpeg
pip install -U yt-dlp

yt-dlp https://www.youtube.com/watch?v=dQw4w9WgXcQ

That's it! You're done

Other useful packages (Optional)

pgk install neofetch

pkg install imagemagick
pkg install git
pkg install vim 

ZSH

pgk install zsh
# set zsh to be the default shell
chsh -s zsh
# oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

ZSH plugins

pgk install build-essential 
pgk install file
pgk install curl 

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Edit the ~/.zshrc file to include the newly installed plugins

@Bakr-Ali
Copy link

Hello! I'm having the following errors running these commands:

~/.../downloads/Termux $ virtualenv venv
PermissionError: [Errno 1] Operation not permitted: '/data/data/com.termux/files/usr/bin/python' -> '/storage/emulated/0/Download/Termux/venv/bin/python'
~/.../downloads/Termux $ source venv/bin/activate
bash: venv/bin/activate: No such file or directory

Could you help, please?

@cyrillkuettel
Copy link
Author

cyrillkuettel commented Mar 26, 2024

You can try this
And try again. This could be a mistake in the document.

cd ~/downloads
virtualenv venv
# etc... same as above

The problem is likely due to the fact that Termux does not have write permissions in the target directory where the virtual environment is being created

@Bakr-Ali
Copy link

I think you meant ~/storage/downloads? Still not working.
And Termux does have permission to write there as the last command works:

~/.../downloads/Termux $ cd ~/downloads
bash: cd: /data/data/com.termux/files/home/downloads: No such file or directory
~/.../downloads/Termux $ cd ..   
~/storage/downloads $ virtualenv venv
PermissionError: [Errno 1] Operation not permitted: '/data/data/com.termux/files/usr/bin/python' -> '/storage/emulated/0/Download/venv/bin/python'
~/storage/downloads $ cd Termux                            
~/.../downloads/Termux $ echo "test" > test1.txt

Anyway, thank you for the help. I'll use it without virtual environments.

@cyrillkuettel
Copy link
Author

Good. I updated it. No need for virtualenv 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment