Skip to content

Instantly share code, notes, and snippets.

@McFlat
Last active November 12, 2020 18:40
Show Gist options
  • Select an option

  • Save McFlat/bd6eedfad331005acb0fa9826136cdbf to your computer and use it in GitHub Desktop.

Select an option

Save McFlat/bd6eedfad331005acb0fa9826136cdbf to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# this program should work only on linux and mac not windows
# this program download files from server one at a time instead of many in order to avoid errors due to rate limits
# 1. download/install mini client program first called mc
# https://min.io/download#/linux
# https://min.io/download#/macos
# 2. configure the server to download videos from
# mc config host add download-troo https://data.troo.tube:443 download 123-Jesus-Christ-Lives-321
# 3. find a directory on the server to download all the videos from website or with mc ls command
# 4. mc ls
# 5. download all "Karen B" videos into the directory where you put this program
# ./balls.sh "Karen B"
trap kill_it TERM # 15 - Termination signal
trap kill_it PIPE # 13 - Broken pipe: write to pipe with no
trap kill_it SEGV # 11 - Invalid memory reference
trap kill_it KILL # 9 - Kill signal
trap kill_it FPE # 8 - Floating point exception
trap kill_it ABRT # 6 - Abort signal from abort(3)
trap kill_it ILL # 4 - Illegal Instruction
trap kill_it QUIT # 3 - Quit from keyboard
trap kill_it INT # 2 - Interrupt from keyboard
trap kill_it HUP # 1 - Hangup detected on controlling terminal or death of controlling process
KILLED=false
function kill_it() {
echo "Killed $@";
KILLED=true;
exit 1;
}
DIR="$1"
SERVER="download-troo"
[ ! -d "$DIR" ] && mkdir "$DIR" # make directory where things are placed if not exists yet
IFS=$(echo -en "\n\b");
for i in $(mc ls $SERVER/videos/"$DIR" --no-color | awk '{$1=$2=$3=$4=""; print $0}' | sed -e 's/^ *//'); do
if [ $KILLED == false ]; then
mc cp $SERVER/videos/"$DIR"/"$i" "$DIR";
fi;
done
mc mirror $SERVER/videos/"$DIR" "$DIR"
@McFlat
Copy link
Copy Markdown
Author

McFlat commented Nov 12, 2020

Got balls?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment