Skip to content

Instantly share code, notes, and snippets.

@joeheyming
Created May 18, 2020 16:05
Show Gist options
  • Save joeheyming/3d05024c1d471ec43acc3aaf7eeb6ae5 to your computer and use it in GitHub Desktop.
Save joeheyming/3d05024c1d471ec43acc3aaf7eeb6ae5 to your computer and use it in GitHub Desktop.
Download all the simpsons episodes
#!/bin/bash
LINKS=$(curl --silent http://pixa.club/en/the-simpsons/ | grep -E 'href="/en/the-simpsons/season-[0-9]+/epi' | tr -d ' ' | awk -F'"' '{print $2}' | gsort --version-sort | tail -n+250 )
# echo "LINKS = $LINKS"
cd ~/simpsons;
# exit 1
set -x
for link in $LINKS; do
echo $link;
season=$(basename $(dirname $link));
echo "season = $season"
video=$(curl --silent http://pixa.club$link | grep -o '<video .*src=.*>' | sed -e 's/<video .*src=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d');
echo "video = $video"
name=$(basename $video)
if [ ! -d ~/simpsons/$season ]; then
mkdir -p ~/simpsons/$season/;
fi
if [ ! -f ~/simpsons/$season/$name ]; then
curl "http://pixa.club$video" -H 'Referer: http://pixa.club/en/the-simpsons/season-1/epizod-3-homer-s-odyssey-the-simpsons' -H 'Accept-Encoding: identity;q=1, *;q=0' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' -O $name
mv $name ~/simpsons/$season/
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment