Skip to content

Instantly share code, notes, and snippets.

@duracell80
Last active January 31, 2022 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duracell80/b7ce8c159c258ccc6bb09d7356cac220 to your computer and use it in GitHub Desktop.
Save duracell80/b7ce8c159c258ccc6bb09d7356cac220 to your computer and use it in GitHub Desktop.
Faster youtube-dl
#!/bin/bash
echo "$1" >> ./yt-dl.txt
https://www.youtube.com/watch?v=p8NqfwhrLxE
https://www.youtube.com/watch?v=ZdoMlrSddQU
#!/bin/bash
#rm -rf *.part
youtube-dl --external-downloader aria2c --external-downloader-args '-c -j 10 -x 10 -s 10 -k 1M' -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' -a yt-dl.txt
FILENAME="yt-dl.txt"
LINES=$(cat "${FILENAME}")
for VIDEO in $LINES
do
IFS='v='
read -a VID <<< "$VIDEO"
if ls *${VID[2]}* 1> /dev/null 2>&1; then
if ls *${VID[2]}*.part.aria2 1> /dev/null 2>&1; then
echo "Failed download for Video ID ${VID[2]}. Deleting chunks, leaving URL in download list."
rm *${VID[2]}*
else
echo "Successful download. Removing Video ID ${VID[2]} URL from download list."
gawk -i inplace '/$VID[2]/' $FILENAME
fi
fi
done
mv *.mp4 ../
mv *.webm ../
mv *.mkv ../
mv *.mp4 ../
mv *.webm ../
mv *.mkv ../
#!/bin/bash
#rm -rf *.part
youtube-dl --external-downloader aria2c --external-downloader-args '-c -j 15 -x 15 -s 15 -k 1M' -f 'bestvideo[height<=2160]+bestaudio/best[height<=2160]' -a yt-dl.txt
FILENAME="yt-dl.txt"
LINES=$(cat "${FILENAME}")
for VIDEO in $LINES
do
IFS='v='
read -a VID <<< "$VIDEO"
if ls *${VID[2]}* 1> /dev/null 2>&1; then
if ls *${VID[2]}*.part.aria2 1> /dev/null 2>&1; then
echo "Failed download for Video ID ${VID[2]}. Deleting chunks, leaving URL in download list."
rm *${VID[2]}*
else
echo "Successful download. Removing Video ID ${VID[2]} URL from download list."
gawk -i inplace '/$VID[2]/' $FILENAME
fi
fi
done
mv *.mp4 ../
mv *.webm ../
mv *.mkv ../
#!/bin/bash
chmod a+x *.sh
sudo apt-get update
sudo apt-get install -y aria2 youtube-dl
pip3 install --upgrade youtube-dl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment