Skip to content

Instantly share code, notes, and snippets.

@tdragonite
Forked from badboy/HOWTO.md
Last active November 8, 2018 18:09
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save tdragonite/b084d4af4beefbde7ef9 to your computer and use it in GitHub Desktop.
Save tdragonite/b084d4af4beefbde7ef9 to your computer and use it in GitHub Desktop.
iTunes Festival London 2014 show downloader

**
NEW VERSION (APPLE MUSIC FESTIVAL 2015 ALSO) & UPDATE HERE -> https://github.com/tdragonite/iTunesFestivalDownloader
**
iTunes Festival Show Downloader - London 2014

  1. Find the day of the show of the artist you want to download. Look at: http://www.itunesfestival.com
  2. Give execution permission to the script: chmod 777 itunes-festival.sh
  3. Launch the script: ./itunes-festival.sh day artist <br > Please, remember: NO SPACE IN THE ARTIST NAME!
    F.e: Tony Bennett = tonybennett, The Script = thescript. Thanks! <br > Examples: ./itunes-festival.sh 06 tonybennett <br > ./itunes-festival.sh 15 thescript <br >
  4. Have fun!
    Additional note:
    You can also force a specific artist id (this is useful for special artist combination, like Kate Simko and London Electronic Orchestra or for Placido Domingo, mistaken named plcidodomingo from Apple). <br > Find the artist id trought Google (search for "Kate Simko Itunes Store" and look at the artist id in the URL of the iTunes Store result) <br > Launch the script: ./itunes-festival.sh 01 katesimkolondonelectronicorchestra 76055920 <br >

Work also on OS X (remember: it isn't an Apple Script but a shell script: you need to use through Terminal). <br > Tnx to the original creator! <br > Tnx to sylvaingi for resume feature!

#!/bin/bash
# iTunes Festival 2014 - Show Downloader
# Variables
cookie="token=$(curl -s http://itunes.apple.com/apps1b/authtoken/token.txt)"
tag=$1
artist=$2
counter=1
output=${artist}_itf${tag}092014.ts
# Making temp directory
mkdir -p $artist
cd $artist
# Search artist id
if [[ -z "$3" ]]; then
api=$(curl -s "https://itunes.apple.com/search?term=$artist&entity=musicArtist&attribute=artistTerm&limit=1")
idartist=$(expr "$api" : '.*"artistId":\([^"]*\),')
else
idartist=$3
fi
# Fetching parts links
echo "iTunes Festival 2014 - Start download of ${artist} show ($tag/09/2014)"
index=$(curl -s -b "$cookie" http://streaming.itunesfestival.com/auth/eu6/vod/201409$tag/v1/${idartist}_${artist}_desktop_vod.m3u8 | tail -n1)
# Check if the input data are right.
if [[ $index =~ "</Message></Error>" ]]; then
echo "Error! Wrong day or artist name. Check the input parameters and remember: NO SPACE IN ARTIST NAME!"
cd ..
rm -r $artist
exit 1;
fi
# Fetching parts links
files=$(curl -s -b "$cookie" http://streaming.itunesfestival.com/auth/eu6/vod/201409$tag/v1/$index)
items=$(grep -o song <<< ${files[*]} | wc -l | tr -d ' ')
# Download parts
for i in $files; do
if [[ "$i" =~ "song" ]]; then
# Check if file already exist
if [[ ! -f $counter.ts ]]; then
echo "Downloading part $counter of $items"
# Check download status and exit if fail
until curl -m 600 -b "$cookie" http://streaming.itunesfestival.com/auth/eu6/vod/201409$tag/v1/8500_256/$i > $counter.ts; do
rm -f $counter.ts
echo "Failed to download. Try re-run the script for resume."
exit 1;
done
fi
counter=$((counter+1))
fi
done
# Merging parts and move in parent directory
echo "Building: $output"
cat $( ls -1 *.ts | sort -n ) > $output
mv $output ../
cd ..
rm -r $artist
echo "Done."
@bvanpeski
Copy link

This is awesome. Great work!

@TwentyFifty
Copy link

Hi all, I'm trying to download the Foy Vance gig on the 29th. I get to the final stage of executing the script but the commands ".itunes-festival.sh 29 foyvance" and ".itunes-festival.sh 29 foyvance 68235486" return the error "-bash: .itunes-festival.sh: command not found" - I've checked the date and executed the permission so know it's finding the file but I can't work it out...any suggestions please?

@tdragonite
Copy link
Author

@TwentyFifty ahem... probably because it's ./itunes-festival.sh, with the slash. Like any other bash script in the world...

Thanks @bvp663 :-)

@TwentyFifty
Copy link

Thanks, it's my first time doing this and worked hard to learn everything else, just missed that mistake! Much appreciated.

@pisanggila
Copy link

// Never Mind
// I have it working now, I used: ./itunes-festival.sh 26 lennykravitz 160410

Thanks for the script!!

Just a little question: I am trying to download the Lenny Kravitz show (using: ./itunes-festival.sh 26 lennykravitz) but I am getting the error: "Error! Wrong day or artist name"

I already downloaded two other shows, Tony Bennett and Beck, so I got the script working :) (total newb here :p)

Am I doing something wrong?

@oriordanp
Copy link

Just wanted to add a comment to say "thanks" to all the people who contributed this.

@vinyldust
Copy link

Big thanks for the script tdragonite! - Worked Great!

@tdragonite
Copy link
Author

Tnx guys ;-)
@pisanggila sorry for the late answer. I've fixed this little bug, there was a problem with the iTunes API for the artist id search :-)

@DBRussell123456
Copy link

can u make one to download taylor swift the 1989 tour from apple music asap plz

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