Skip to content

Instantly share code, notes, and snippets.

@betrisey
Last active December 10, 2020 01:27
Show Gist options
  • Save betrisey/610ab99d67a302ddf3c3 to your computer and use it in GitHub Desktop.
Save betrisey/610ab99d67a302ddf3c3 to your computer and use it in GitHub Desktop.
iTunes Festival - Download recordings
  1. Get your cookie. Either proxy your iPhone/iPod/iPad and record the cookie using the proxy server of your choice or capture the request using your AP with Wireshark or similar

  2. Make sure you have a cookie like token=expires=1409714101~access=/auth/*~md5=2d4466c1...

  3. Find the day of the artist you want to load (e.g. 01, 02, 10, 25) Find the artist on iTunes https://itunes.apple.com/us/artist/*deadmau5*/id*78011850* and take its ID and its name. Add an underscore between these two. (e.g. 78011850_deadmau5)

  4. Launch the script: sh itunes-festival.sh cookie day id_artist

    sh itunes-festival.sh "token=expires=1409714101~access=/auth/*~md5=2d4466c1" 01 78011850_deadmau5

  5. Have fun.

#!/bin/bash
cookie=$1
day=$2
artist=$3
mkdir -p $artist
cd $artist
index=$(curl -s -b "$cookie" http://streaming.itunesfestival.com/auth/eu1/vod/201409$day/v1/${artist}_desktop_vod.m3u8 | tail -n1)
files=$(curl -s -b "token=expires=1409714101~access=/auth/*~md5=2d4466c113b2eb5f10b0ea4ab55df617" http://streaming.itunesfestival.com/auth/eu1/vod/201409$day/v1/$index)
for i in $files; do
if [[ "$i" =~ ".ts" ]]; then
curl -b "$cookie" http://streaming.itunesfestival.com/auth/eu1/vod/201409$day/v1/8500_256/$i > $i
fi
done
cat * > $artist.ts
mv $artist.ts ../
cd ..
rm -r $artist
@Techman749
Copy link

Very nice script!

Could you please tell me what it outputs? So far it's been giving me a bunch of .ts files and by what the console is telling me, it is downloading them 10.2-10.3 MB at a time. Is this right?

Does is combine them all at the end? I'm trying to download deadmau5 as well.

I got my cookie and everything is looking like it's running smoothly in the console, I just wanted to make sure it's going well, because I didn't want to waste my time with it downloading all of these .ts files and it not work.

Is there any extra work that needs to be done on my part? Other than this, THANK YOU SO MUCH FOR MAKING THIS! THIS WAS ONE OF DEADMAU5'S BEST SETS SO FAR AND I WANTED TO SAVE IT FOREVER!

@badboy
Copy link

badboy commented Sep 3, 2014

It combines all chunks to one big .ts file at the end. This file is playable by vlc or other player or could be converted to whatever format you want.

@mingote
Copy link

mingote commented Sep 4, 2014

Excellent! Thank you for that.

By the way, line 10 should be:
files=$(curl -s -b "$cookie" http://streaming.itunesfestival.com/auth/eu1/vod/201409$day/v1/$index)

Thanks once again.

@chismah
Copy link

chismah commented Sep 4, 2014

Hi,
Great job you did there !
I am a stupid newbee, and i am not sure to understand how to find is own cookie, when is it created and where should it be located on iphone/ipad/mac?

@chismah
Copy link

chismah commented Sep 4, 2014

Finaly found cookie with wireshark! and make it work.

Curiously, cat * miss some files when concat. (actually, it use 1/5 files...)

Thanks

@titania424
Copy link

Ok, call me an idiot but I have wireshark and I've looked at all kinds of stuff and still no idea how to get the cookie. Any idea how long these videos stay available? I'm interested in the one from tonight.

@mickartz
Copy link

mickartz commented Sep 5, 2014

ditto on that, anyone know a nice tutorial, trying to grab a cookie off networked iPad I can see the captured packets but other than that no idea where i should be looking for for cookies!?

Thanks in advance

@titania424
Copy link

** EDIT ** I DID GET IT WORKING, READ THROUGH THIS COMMENT

As soon as I posted that, I found it. Ugh. Does this take a long time to download? Took me some time to get the exact band name right, and I got one strange error but it's downloading something.

Edit - on a laptop I found it using wireshark, filtered http, capture when starting the stream through itunes, then looked at the GET.

The problem I have is that the final video doesn't seem to be the whole thing or VLC isn't handling it well. It is 4GB but it starts somewhere in the middle and may even be out of order. Not sure, still working on it. I also got an error at the start, but then it started downloading:

: No such file or directory 10: 8500_256/538811449_5secondsofsummer_vod.m3u8
: command not foundsh: line 12: #EXTM3U

Any thoughts? I may re-download but not remove the files after it does the cat command in the shell script

BTW, this is really awesome that you figured this all out! Thank you!

One more Edit: That error seemed to be meaningless. But the " cat * > $artist.ts" in the script only works if there are less than 10 songs, otherwise it is in the wrong order. I removed the "rm *" from the script and kept the .ts? files and then wrote a stupid script that loops through based on song number and appends to the output file, like this:

for i in ls *song1_*
do
cat $i >> $myout
done

for i in ls *song2_*
do
cat $i >> $myout
done

(oh and for 5 seconds of summer, the id and band name is 538811449_5secondsofsummer)

I tried putting inside of a loop and building the ls command with variables, but inside the backquotes I don't think you can use variables. Anyhow, I have it working and this was the most awesome information, Thank you so much!

@slinkdot
Copy link

slinkdot commented Sep 6, 2014

Hi guys, complete novice here so apologies...

Can someone give me a step by step approach to doing this. I have Wireshark and can locate the cookie for the Kasabian gig last night, but anything after that I have no idea.

How do I write a script?
Is it PC-based (I have a Win7 machine and a Macbook Pro...)

I'd be eternally grateful if someone could give me a beginner's guide :)

Thanks in advance...

@tdragonite
Copy link

@titania424 I've created this one for me, because I've the same problem of wrong order in the final output when I've tried to adapt the original script with 2014 festival.
https://gist.github.com/tdragonite/b084d4af4beefbde7ef9
Ah, and you don't need to obtain manually the cookie :-)

@liudayu
Copy link

liudayu commented Sep 8, 2014

can anyone please help me, i really want download calvin harris' show... but i dont know how to do it and i have almost all assignments & exams due this week... please help
can someone make the sh file for me or the download link..
thank you

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