-
-
Save cxbig/9be30a906b4f3ad810b564003d14e36c to your computer and use it in GitHub Desktop.
Simultaneous downloading YouTube video list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function youtube-dl-list { | |
if [[ -z $1 ]]; then | |
echo 'Please provide list key' | |
return 1 | |
fi | |
local simultaneous=5 | |
local list_url="https://www.youtube.com/playlist?list=$1" | |
for item in `youtube-dl -F $list_url | grep -E '\[youtube\].*Downloading webpage' | sed -E 's/[^ ]* ([^\:]*):.*/\1/'`; do | |
while [[ "$((`ps aux | grep 'no-warning' | wc -l`))" -gt $simultaneous ]]; do | |
sleep 5 | |
done | |
local video_url="https://www.youtube.com/watch?v=$item" | |
youtube-dl -q -i --no-warnings --ffmpeg-location 'youtube-dl -d $*' -o '%(id)s.%(ext)s' $video_url & | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use:
Sample:
# one list link : https://www.youtube.com/playlist?list=PLLnpHn493BHFfs3Uj5tvx17mXk4B4ws4p youtube-dl-list PLLnpHn493BHFfs3Uj5tvx17mXk4B4ws4p
PS: you can change the concurrent task amount in L:7