Skip to content

Instantly share code, notes, and snippets.

@Diederikjh
Last active August 29, 2015 14:06
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 Diederikjh/d35610a3d126b23d5013 to your computer and use it in GitHub Desktop.
Save Diederikjh/d35610a3d126b23d5013 to your computer and use it in GitHub Desktop.
Bash script for downloading files off video sharing site YouTube
#!/bin/bash
if /home/drbergie/scripts/isAfterHoursDownloadTime.py; then
echo "starting download"
DOWNLOAD_PROGRESS_FILE=/tmp/downloadInProgress
LINKS_FILE=/home/drbergie/youtubelinks.txt
if [ ! -f $DOWNLOAD_PROGRESS_FILE ] ; then
echo "1" > $DOWNLOAD_PROGRESS_FILE
cd /tmp/
if [ ! -d yt ] ; then
mkdir yt
fi
cd yt
/usr/local/bin/youtube-dl --all-formats -a $LINKS_FILE
rm *
cd ..
rm $DOWNLOAD_PROGRESS_FILE
else
echo "Skipping download, already in progress"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment