Last active
November 27, 2017 21:45
-
-
Save vincent-zurczak/19f140991e436a035837dbb10389023d to your computer and use it in GitHub Desktop.
Batch script to download Youtube videos from a listing file (one video per line)
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
#!/bin/bash | |
# Configuration | |
DL_DIR="/wherever/you/want" | |
INPUT="/wherever/is/your/file" | |
# We need "youtube-dl" (https://github.com/rg3/youtube-dl). | |
# We here download the best video quality. | |
# One Youtube address per line. Empty lines are ignored. | |
mkdir -p $DL_DIR && cd $DL_DIR | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
if [ -n "$line" ]; then | |
youtube-dl -f 'bestvideo[ext=mp4]/bestvideo/best' $line | |
fi | |
done < $INPUT |
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
rem On Windows, the ffmpeg executable should be referenced in the system path. | |
rem Or it should be located in the same directory than youtube-dl.exe. | |
rem -w: no overwrite | |
rem | |
for /F "tokens=*" %%A in (I:\path\to\my\list.txt) do I:\executables\youtube-dl.exe -w -f "bestvideo[ext=mp4]+bestaudio" %%A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment