Scientific Programming
153 subscribers
158 photos
30 videos
138 files
442 links
Tutorials and applications from scientific programming

https://github.com/Ziaeemehr
Download Telegram
Simply #parallel jobs with #bash script
This is an strightforward way to download a whole playlist from youtube:

I have tried different scripts and packages but I always get many error.
So I came up with this solution:


First of all you need to have youtube-dl installed on your machine,
🖥 Debian:
$ sudo apt install youtube-dl
💻 Mac:
$ brew install youtube-dl

Replace PLAYLIST-URL with a url of your interested one:

in 💾 script.sh
———————————————

youtube-dl --get-id PLAYLIST-URL -i > urls.txt
input="urls.txt"
while IFS= read -r line
do
youtube-dl -c -f 22 "https://www.youtube.com/watch?v=""$line" &
done < "$input"

———————————————
videos are downloaded in parallel at the backgound. Do not close the terminal.
if you want to close the terminal put a nohup at the begining of the command.

chmod +x script.sh # to make executable
nohup ./script.sh. # to run in background

22 in commends control the quality of the video. If you need more options use
$youtube-dl -F VIDEO-URL
to select a proper option.
usually 22 is for the best and 18 is for lower quality.


#bash
#youtube-dl
#download

Anyway ther are other options to use youtube-dl:
stackoverflow