Link to home
Start Free TrialLog in
Avatar of epiphone32
epiphone32

asked on

Dynamically pull Album Art from Amazon

Hello I would like to dynamically pull in album art from amazon for my personal music server.
I have come to the point where i understand amazon's link structure to the images.   This information can be found here (and many other places): http://aaugh.com/imageabuse.html

The actual URL looks like the following:
http://images.amazon.com/images/P/0762423374.01._PE20_SCMZZZZZZZ_.jpg

I could get this working but here is the cather, I dont want to look up every album to obtain the
ASIN.   In the example above the ASIN is 0762423374.   This is the isbn number (stripped of slashes for books), but there is not a set algorithm for calculating the ASIN for a album.

So...
1) Prove me wrong and find the ASIN algorithm based on Artist/Album
                or
2) Provide an alternative method.

Again i want to do this dynamically (nothing stored).  Here is a website that is doing something
similar to what i want (but i dont want to enter information, just pass variables):
http://art4itunes.com/getart/uploadtracks.php

Thanks and goodluck...


Avatar of Harisha M G
Harisha M G
Flag of India image

Hi, try this:

<?
    $str = file_get_contents("http://aaugh.com/imageabuse.html");

    preg_match_all("#\b\d{10}\b#",$str,$matches);
    $ASIN = array_unique($matches[0]);
    print_r($ASIN);
?>


---
Harish
ASKER CERTIFIED SOLUTION
Avatar of CraigHarris
CraigHarris

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is no specific alogithm for how Amazon creates ASINs.  ASINs are uniquely identifiable codes that are used to identify every single product on their website.  Origionally, as they were solely book sellers, their ASINs were actually the ISBN numbers from the books as you have already identified.  You will find that the ASINs for every book listed are identical to the ISBNs without the dashes (-).  

As albumns don't have ISBN numbers, Amazon has to: either manually, or through some automated incriment number in a database, assign an ASIN to an item.  If it's a book they use the isbn, if it's any thing else then it's a random/auto_incrimental number.

Further more, to be able to retrieve information from Amazon's site, I would go with what craig suggested and signup for their web services.  

Hope this helps.