2008

2007

2006

2005

2004

iTunes 7: Fetching artwork for fun and profit

▁ sep 17 2006

With the release of iTunes 7, Apple made a bold promise of letting you download all the artwork you lacked, from your (ahem) ripped CDs. Like short shorts, I like free album covers. I’m sure a lot of people do. Unfortunately, the functionality seems premature and blatantly crippled. I wrote some libraries to fetch artwork from iTMS a while ago, but that was shut down. Now that it’s open again, I decided to write a new library to fetch artwork.

After hours of tcpdump’ing and analyzing a few obscure headers sent, the game was afoot. I wrote a perl library that basically allows you fetch a URL containing a neat 600x600 JPEG. Someone please port it to PHP and Python. I don’t have the time. Without further ado: “i7AWF.pm”:http://www.avantlumiere.com/svn/i7AWF/trunk/i7AWF.pm And here’s how you (can) use it: use i7AWF; my $i7 = new i7AWF; $i7->artist(“Dire Straits”); $i7->album(“Sultans of Swing”); print $i7->payload; Or try the “online demo”:http://printf.dk/cgi-bin/i7AWF.cgi NB: Contrary to popular belief (and word of Jobs), no — you are not required to be logged in to your iTunes account to use this. UPDATE: My friend Nicolas Mendoza has been utterly kind, and ported it to “PHP”:http://www.avantlumiere.com/svn/i7AWF/trunk/i7AWF.php. Oh, and I made the “paper”:http://www.nettavisen.no/it/article741678.ece.

← Previous: New Apples  //  Next: iTunes 7 Free Artwork: Not so much

comments

Manuzhai, 2 years, 2 months ago:

I ported it to Python: http://manuzhai.nl/src/i7awf.py.

Alec, 2 years, 2 months ago:

This is about the coolest album art thing I’ve seen. Well done. ALec

Clint Ecker, 2 years, 2 months ago:

Python Version: http://clintecker.com/i7AWF.py

someone, 2 years, 2 months ago:

I love you

Erik, 2 years, 2 months ago:

Thank you very much! This will go nice with my linux app :)

Paul, 2 years, 2 months ago:

As soon as I saw this, I thought “This must be ported to PHP and Python!” Then I saw your comment. I’m gonna take a whack at it tonight! I’ll let you know how it goes.

nysnoe, 2 years, 2 months ago:

Thanks for this great work! Is it possible to make this script work for the covers from tv shows in the US iTunes store? Example (Lost, Season 1): http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewTVSeason?id=81864976&s=143441 If I enter “Lost” for artist and “Lost, Season 1” for album I don’t get a result. Thank you!!!

aKzenT, 2 years, 2 months ago:

Converted to C#: http://download.yousendit.com/14E640F209DD1B8F Usage: Fetcher f = new Fetcher(); f.Fetch(“My Artist”, “My Album”); //Write result to file f.WriteToFile(“My File.jpg”); //Alternatively: //Get Image-Object System.Drawing.Image img = f.GetImage(); //Get Image-Stream System.IO.Sream stream = f.GetStream(); Couldn’t be easier ;-)

Joshua E Cook, 2 years, 2 months ago:

Here’s a Ruby variant: http://blinkinglights.org/snippet/ruby/I7AWF.rb

Filthy, 2 years, 2 months ago:

So Is there a way to use it threw iTunes are to automatically update your entire library?

Jesper, 2 years, 2 months ago:

Wow. You guys are amazing. I don’t know you, but thanks! I hadn’t anticipated this big a deal on this code, but it’s great, and I can’t believe this has been ported to PHP, Python, C# and Ruby!

dsync, 2 years, 2 months ago:

this sounds great and all, but how r u supposed to use it? please email me.

kyle saric, 2 years, 2 months ago:

how do i use it though?

anony, 2 years, 2 months ago:

Java? :)

, 2 years, 2 months ago:

The python script isnt working… I get Traceback (most recent call last): File “./hastag.py”, line 42, in ? url = i.payload() File “/home/icebreak/mp3artwork/i7AWF.py”, line 59, in payload fp = opener.open(request) File “/usr/lib/python2.3/urllib2.py”, line 326, in open ‘open’, req) File “/usr/lib/python2.3/urllib2.py”, line 306, in _callchain result = func(*args) File “/usr/lib/python2.3/urllib2.py”, line 901, in httpopen return self.doopen(httplib.HTTP, req) File “/usr/lib/python2.3/urllib2.py”, line 880, in doopen h.putheader(k, v) File “/usr/lib/python2.3/httplib.py”, line 1041, in putheader self.conn.putheader(header, ‘\r\n\t’.join(values)) If anybody can fix this, i’ll have a very nice surprise for you all :)

floodedCodeBoy, 2 years, 2 months ago:

Awesome! but how would I get this to work on my local webserver so I can run the script locally? any ideas anybody? am currently calling it like u would any other class in php and calling the artist, albulm, and payload function… and nada… maybe cause i’m on a windows box? please o pretty please help :)

TommyZ, 2 years, 2 months ago:

Please anybody repost the C# port. D/L is not possible. TIA, TommyZ

auri, 2 years, 2 months ago:

Awesome! I tried signing up for the music store but it didn’t let me, I have no idea why or how to get around it. You saved my life! :P

chris, 2 years, 2 months ago:

sorry for being a complete dumbass, but can someone throw up and example page for the php variant? i was hoping i could automatically parse the artist/album to the script to bring up covers in a new window…

nysnoe, 2 years, 2 months ago:

Is there someone who can make this work for TV SHOWS and AUDIOBOOKS in the US store?

Bastardo Anónimo, 2 years, 2 months ago:

Wow man. Just wanted to thank you, this is awesome.

Collin Allen, 2 years, 2 months ago:

Just a few days ago, I (independently) wrote a PHP version: http://www.command-tab.com/2006/09/12/itunes-art-redux/ Full source is available. Download. Modify. Re-use.

Mikeo, 2 years, 2 months ago:

the python one is down :(

digiPencil, 2 years, 2 months ago:

Cool tool, have been looking for something like this for some time but, forgiving my ignorance.. what is the reason for this as you can just sign up for the store and then use the feature with any tracks including those downloaded from other sources and those ripped from CDs, it’s not like you get charged anything or ever have to actually buy anything. I imagine I must be mistaken somewhere, is it not a good idea to do this? does apple sort through your library or something?

Jesper, 2 years, 2 months ago:

@digiPencil: No, Apple does (probably) not scan through your song library. This is a re-usable piece of software that other developers can use in their own software (e.g. a CD organizing website, or whatever). As a minimal example, the demo was supplied. That’s one use of the tool. Since it’s ported to 5 languages now, you can use it in the language that you prefer. Oh, and also, most of the covers that iTunes 7 downloads itself, are low resolution. And they don’t get bundled with the file itself. And if your ID3 tag isn’t precise, it can be a real pain finding the proper album cover. Etc.

Boysterload, 2 years, 2 months ago:

This seems like it could help out a lot of people. But, I don’t know how it works. Is there a GUI front end for it? Or is it a plugin for iTunes? Thanks!!

_kin, 2 years, 2 months ago:

Great stuff! The country i live in cant support an iTunes account and I’m not into programming too. But ut online demo works good enough for me. Many thanx. Plz dont remove the online demo. Hahah

clint ecker, 2 years, 2 months ago:

I fixed my server which wasn’t displaying the Python version. IMO and with all due respect it’s much cleaner and less prone to breakage than Manuzhai’s version. http://clintecker.com/i7AWF.py

mat, 2 years, 2 months ago:

I made a small python script that parses a rhythmbox db file (that needs to be copied to test.xml, see the script) and tries to find and download a cover for each album, using the python script from http://clintecker.com/i7AWF.py with some little changes. Check it out: http://pastebin.ca/176269

codeman38, 2 years, 2 months ago:

A fairly canonical list of iTunes country codes, for the record, can be found in this Perl script, which I found through some Googling: http://www.oreillynet.com/mac/blog/2006/04/itunesswitchingcountries_fro.html (Interesting that the European cover of Fatboy Slim’s “You’ve Come A Long Way Baby” is so utterly different from the US/Canada version!)

Cameron, 2 years, 2 months ago:

Amazing! But… this is all fine and dandy except for the fact that you have to input everything manually (unless I missed something). Anyone know how to automate this process to find all my artwork for me?

codeman38, 2 years, 2 months ago:

…Speaking of Fatboy Slim, this is particularly odd— and it’s not specific to the script; it’s something weird with iTunes’ server. I’m getting the UK album cover for Fatboy Slim’s “You’ve Come A Long Way, Baby,” even with the US country code, despite the fact that the US iTunes store shows the US album cover. Yet “Why Try Harder” gives me the US cover even with the UK code. Weeiirrd.

ron, 2 years, 2 months ago:

doesnt work for Audiobooks…

James, 2 years, 2 months ago:

Wow. Good effort…I’m know nothing about the code so was just wondering if there is an easy way to integrate it into iTunes or run it as a program to automatically update the Album Art for my entire library? Thanks.

JackRazz, 2 years, 2 months ago:

I’m also hoping that anyone who managed to get the c# code will post it here or make it available.

mrsticks1982, 2 years, 2 months ago:

C# library link does not work. Can someone repost?

Kevin Futter, 2 years, 2 months ago:

I get a parse error on line 78 when I try to use the PHP version. I do know PHP, but I’m not an expert and haven’t looked at the code yet either (which I probably should do!). Just FYI, in case I’m not the only one.

hornt, 2 years, 2 months ago:

How do you guy do all these programming to incoporate it automatically in iTune 7? Please kindly advice… So Is there a way to use it so that iTunes automatically update your entire library?

mxz, 2 years, 2 months ago:

Now we just need an application that would parse your iTunes library, automatically fetch and add all the cover images for your albums.

Joel, 2 years, 2 months ago:

Can anyone post here the C# version? Link is dead.

Danny, 2 years, 2 months ago:

PHP script gives me a Parse Error (unexpected TOBJECTOPERATOR) on line 78.

Fan, 2 years, 2 months ago:

C# port not available already! Upload it again please!

Tom, 2 years, 2 months ago:

Scan all the mp3 on your computer with this script, and auto-get their artwork: http://tom.zickel.org/getartwork/

Sima, 2 years, 2 months ago:

Hello to all Would U be so kind to chewing it for end-users? I try all link and did not get any resalt. I am big Zero in programming, as most apple users… Drug& drop mostly. I did some stuff as site www.sima.spb.ru but with application. Would be great to have some friendly hack, app etc… Thx Sima

alec, 2 years, 2 months ago:

I also tried to sign up for itunes, but couldn’t (I live in Korea). I have hundreds of albums without cover shots, and this sounds great, but I have no idea at all how to make it work. If someone could email me about how it works I’d really appreciate it…

Nicolas Mendoza, 2 years, 2 months ago:

The PHP script also requires PHP5, on the other hand, it’s about time to switch isn’t it ;D

Eberth, 2 years, 2 months ago:

hi, how can i install it on my server??

hello, 2 years, 2 months ago:

Wow, is this going to turn into a Rosetta stone for programming languages?

kilo, 2 years, 2 months ago:

Can somebody make a scrip to get “genre/year”-information from iTunes Shop and add it to mp3 ID3?

Kelsey, 2 years, 2 months ago:

Java port, by popular demand: http://www.prism.gatech.edu/~gte833z/i7AWF/

JackRazz, 2 years, 2 months ago:

Jesper & aKzenT, I set up a simple project and got my first album cover with it. Works good. Many thanks to both of you. I’ll slowly get it to do what I need. Thanks - JackRazz

alex, 2 years, 2 months ago:

i need this!! how do i make it work with itunes? is it a script or a plugin?

Jesper, 2 years, 2 months ago:

Since the author didn’t post it here, I will: C# Port: http://www.programmers-source.com/fetcher.cs.txt

Josh, 2 years, 2 months ago:

I’ve been able to update my iTunes Album Art Grabber to work now.. so if you’re looking for a quick place to get it, check it out :) http://www.thejosher.net/iTunes/

John, 2 years, 2 months ago:

how can i find O.S.T cover??(ex.step up) thanks=)

Nels, 2 years, 2 months ago:

Yet another Java implementation. http://jroller.com/page/rummage?entry=i7awfforjava

Mister Lucky, 2 years, 2 months ago:

Here is a Windows solution, but does not use an EXE. It uses Windows Script Host, so you can easily modify the codebase, without a re-compile. Here is the iTunesClient object. http://www.teamcon.com/pub/concepts/microsoft/iTunesClient/i7AWF.js Here is an example Windows Script File, that you just double-click to launch. Shows several scripting, or commandline examples. http://www.teamcon.com/pub/concepts/microsoft/iTunesClient/i7AWF.js.wsf Furthermore, you can use the example page via commandline w/o any modifications. Just copy both files locally and launch: c:\some\path\i7AWF.js.wsf “311” “311” “d:\songs\311\311\folder.jpg” and viola, you should see a newly created folder image.

Mister Lucky, 2 years, 2 months ago:

Sorry, it seems my host will not serve up the WSF filetype. I’ve renamed it to i7AWF.wsf.txt You can simply dump the .txt part, then double-click or commandline to launch. http://www.teamcon.com/pub/concepts/microsoft/iTunesClient/i7AWF.wsf.txt

John Bailon, 2 years, 2 months ago:

Here‘s an ajaxified version of Collin Allen’s PHP proof of concept.

Marc, 2 years, 2 months ago:

Can anyone provide an exe for Windows (receiving three arguments : artist album save_path) ? Thanks.

bigbadtko, 2 years, 2 months ago:

how does this work for compilation albums or soundtracks? i’ve tried putting “various artists” and the soundtrack title but nothing comes up

_ck_, 2 years, 2 months ago:

Quick question - this only can fetch the front cover correct? The back covers are not available? Thanks.

Tom, 2 years, 2 months ago:

New GUI version for all of you: http://tom.zickel.org/getartwork/ old version here: http://tom.zickel.org/getartwork.py/ enjoy !

Bruce Phillips, 2 years, 2 months ago:

A Java version with a Swing front end. http://www.stfm.org/test/java/

Marc, 2 years, 2 months ago:

Big thanks for the Windows script !

Bruce Phillips, 2 years, 2 months ago:

A ColdFusion mash up of MusicBrainz (see: http://wiki.musicbrainz.org/XMLWebService#head-e935df56afc2b280ac8e6a5944ec6b930adadb1f ) and the iTunes album cover Java program. Allows you to enter an artist or band and get all available album covers. http://www.stfm.org/test/java/getAlbumCovers.cfm

, 2 years, 2 months ago:

an applescrip for a itunes integration would be nice.

Chris, 2 years, 2 months ago:

Is there anyway in which to grab various artist compilation albums? I, like John tried putting ‘Various Artists’ or an artist from the actual compilation itself into the ‘Artist’ field along with the album name in the ‘Album’ field - either way I’ve had no joy. Is it at all possible? Regards.

esprit, 2 years, 2 months ago:

Can this script be adapted to fetch movie soundtrack artwork? As far as I can tell, it’s currently unable to fetch iTMS artwork for those.

JeffF, 2 years, 2 months ago:

To find compilation albums, try just entering “artists” for the artist field (without the quotes) and the album name as it appears in the iTunes store for the album field. In some cases this won’t work (i.e. it works for “Radio Hits of the 80’s”, but not “Radio Hits of the 70’s”). Go figure. Anyone notice that quite a few covers that were 320x320 a few weeks ago are now 600x600? However, a tiny number now come up 320x320 that were 600x600. Seems to change almost daily.

chenny, 2 years, 1 month ago:

Seems it doesn’t work anymore. It only returns a URL, not an image. Any ideas?

Jesper, 2 years, 1 month ago:

The reason why this is broken, is because apple encrypts their artwork from now on. Read my latest blogentry for more.

Brett, 2 years, 1 month ago:

I’ve got the same problem and chenny. It won’t load the album art anymore… Any ideas?

hephey, 2 years, 1 month ago:

This is just awesome.. dont you just love that word.. awesome. :D

Tomato, 2 years, 1 month ago:

Will there be an plug-in for iTunes someday?

Jesper, 2 years, 1 month ago:

@Tomato: I don’t think so. iTunes already “includes” this functionality. @vir: This might be caused by the fact that I switched the storefront in my demo recently. It’s now fetching from the Danish storefront, not the Norwegian that the open sourced scripts use. Try switching the storefront ID with 143458.

mkh, 2 years, 1 month ago:

looks like the system got blocked again :(

vir, 2 years, 1 month ago:

Your scipt on my computer (Russian Windows2000SP4) returns the following link for (“The Doors”, “The Doors”): http://a1.phobos.apple.com/r10/Music/y2004/m05/d04/h18/s05.envxllpu.enc.jpg?downloadKey2=11614701664eb0056d2f967df197bf9737e9889d28 And this doesn’t seem to by an image. But your online demo returns: http://a1.phobos.apple.com/r10/Music/d6/e1/eb/mzi.bftsocxt.600x600-100.jpg?downloadKey2=1161512272249b25b56e4069f4761d1f9167d4abfa and this is what I’d like to get…

timg, 2 years, 1 month ago:

has anyone developed a windows app to parse library xml file and download art itunes 7 style, then patch up the xml file? tall order, i’m sure… but it would be the hottest app on teh interweb. itunes album art by ben pritchard is the best app i’ve seen yet, but it causes a nasty delay in the beginning of songs that don’t have the art already associated.

Alex, 2 years, 1 month ago:

The script and the online demo seem to not be returning pictures anymore, what’s up with that…. when using the python script, I get a site with a link that firefox thinks is a picture…..? wtf is going on?

, 2 years, 1 month ago:

The script seems broken or Apple has done something with how their artwork repository is accessed. As of yesterday I noticed all of these scripts now failing to return artwork with various file not found errors.

John Lockwood, 2 years, 1 month ago:

To Alex and Anonymous. It is not [completely] broken, it is that Apple appear to be gradually encrypting all the artwork so it cannot be displayed by the script. For example, Pink Floyd’s “Dark Side of the Moon” no longer seems to work but Hard-Fi’s “Stars of CCTV” still does. Encrypting the artwork is rather petty and even sillier. I wanted recently to get artwork for Nirvana’s “In Utero” and this is now encrypted. As I do have an iTunes account I was able to use iTunes to “Get Album Art”. Fortunately in this case the artwork returned matched the UK edition of the CD. I was then able to convert the .itc file to an ordinary jpeg for use with Windows Media Player. I then CLEARED the “Got” art and replaced it with the jpeg. This meant that the art was then EMBEDDED in all the tracks! Note: the above does not help when iTunes returns the ‘wrong’ artwork for your country (e.g. Fatboy Slim’s “Why Try Harder”, iTunes always ‘Gets’ the US cover and not the UK cover, which fortunately I was able to get via the script). All this faffing about because Apple are being anally retentive.

Skeeve, 2 years, 1 month ago:

Hi! Great perl Module. Unfortunately it sometimes fails to download pictures and I don’t know why. Try for example ‘Joe Jackson’ ‘Big World’. I get a file that is said to be jpg, but when trying to open it’s not accepted as jpg. My script I used to download:

#!/usr/bin/perl
use i7AWF;
my $i7 = new i7AWF;
$i7->artist($ARGV[0]);
$i7->album($ARGV[1]);
if ( $i7->payload ) {
                my $extension = '';
                $extension= $1 if $i7->payload =~ /(\.[^.?]+)\?/;
        my $ua = LWP::UserAgent->new;
        $ua->timeout(10);
        $ua->env_proxy;
        my $response = $ua->get( $i7->payload );
        if ($response->is_success) {
                        my $filename= $ARGV[0].'-'.$ARGV[1].$extension;
                        open my $image, '>', $filename
                                or die "Can't create $filename: $!\n";
                        print $image $response->content;
                        close $iamge;
                        print length($response->content),' ',$filename,"\n";
        }
        else {
            die $response->status_line;
        }
}
else {
        die "Noting for $ARGV[0], $ARGV[1]\n";
}
Skeeve, 2 years, 1 month ago:

Joe Jackson’s Big World isn’t shown by the online demo either

Alex, 2 years, 1 month ago:

All I need is the album art for the Pink Floyd album More, if anyone can post this somewhere, that would be greatly appreciated.

Sebastian78, 2 years, 1 month ago:

D@mn…..I was on my way to updating 120GB of mp3 files with 200x200 or max 300x300 artwork… Workaround please..PLEASE……..

Sebastian78, 2 years, 1 month ago:

The White Stripes - Get Behind Me Satan still works…

dowhatitdo, 2 years, 1 month ago:

Update: Itunes won’t return the wrong art for your country anymore because it gives you the art related to the country u have your account set up in. I have a multiple accounts in different countries. I have noticed that in some cases the quality differs from country to country. 1 country may have a rare album in the full 600x600 while the others will only have it in 320x320.

eddy, 1 year, 9 months ago:

ihave a problem with itunes 7 its not working properly videos convert but theres no audio in the ipod video nor the itunes converted video does somebody knows the problem

powered by