Download Youtube Videos With Python

Father

Professional
Messages
2,602
Reaction score
866
Points
113
This is working on:
- Android(Termux)
- MacOS
- Linux

On android download termux from playstore.

Code:
$ apt install wget python python-pip -y
$ wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/youtube-dl
$ chmod a+rx /usr/local/bin/youtube-dl
$ pip install youtube-dl
$ apt install youtube-dl

Single MP3:
Code:
$ youtube-dl -v -x --embed-thumbnail --audio-format mp3 https://www.youtube.com/watch?v=YTHr7gxwYUQ

Playlist:
Code:
$ youtube-dl -x --audio-format mp3 --playlist-start 1 --playlist-end 14 https://www.youtube.com/watch?v=PTVgUrRNM7E&list=PLoyUcIQiGLsVWzXL7RONZJycQX4U1CsCR

Replace the links.

Save mp3 to sdcard
Code:
$ termux-setup-storage
$ mv -v *.mp3 /sdcard/

(Open File Explorer In Root Of Your Android Device Should Be Downloaded MP3 Files)

SHARE AND SUPPORT US
 
Hmm, at the moment this tool allows you to use python to grab and download video and audio from youtube. It lets you choose where to save the downloaded files, and what resolution to be on the downloaded ones. As far as I know the resolution can’t be higher than the resolution the original video has. Also is much easier to write python in virtual studio code, and to run it. Unfortunately, your option is not working for windows, as a recommendation for windows users, is to write the code by themselves pr by trying youtube converter and downloader pro, a good web based option, that allows to download videos from youtube.
 
Last edited:
Top