1

I'm trying to grab the highest quality image for each item that a GetSellerList request returns. The HQ images can be viewed manually by clicking the image on a product page (so I know they exist).

Unfortunately, it only returns medium sized images. I've googled and googled, only to find a lot of mentions of SelectorOutput, which can only be used in the Finding API and that is completely irrelevant to what I'm trying to do.

Here's my xml input (note that my auth is taken care of with a js library I'm using):

var xml = '<?xml version="1.0" encoding="UTF-8"?>' +
       '<GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">' +
          '<RequesterCredentials>' +
            '<eBayAuthToken> <!-- my ebayAuthToken -->' +
          '</RequesterCredentials>' +
          '<UserID>samurai-gardens</UserID>' +
          '<StartTimeFrom>2016-01-01T23:35:27.000Z</StartTimeFrom>' +
          '<StartTimeTo>2016-02-01T23:35:27.000Z</StartTimeTo>' +
          '<DetailLevel>ItemReturnDescription</DetailLevel>' +
          '<Pagination ComplexType="PaginationType">' +
           '<EntriesPerPage>10</EntriesPerPage>' +
        '<PageNumber>1</PageNumber>' +
        '</Pagination>' +
        '</GetSellerListRequest>"';

I am getting the correct output, I just don't see how I can pull the large images with this. Thanks ebay for a super frustrating api!

mscdex
  • 104,356
  • 15
  • 192
  • 153
bmills
  • 537
  • 1
  • 6
  • 12
  • 1
    Difficult to find information on this topic. My thought would be they may actually limit this ability so that people don't use eBay as a product photo repository. Have you looked at decomposing the image URL when you click an image on the eBay website? I'm thinking if you know the root EPS URL which you can retrieve without difficulty, and how the eBay URL is constructed to request the large image, you might be able to retrieve the data you are looking for. – Nate M. Mar 29 '16 at 14:03
  • 1
    You have to dig into the source of the eBay pages to find the actual image URL, but what I am seeing is that every high resolution image has a name of s-l1600.jpg. This may be coincidence as I only checked 3 random listings. URL is of form http://i.ebayimg.com/images/g/dCMAAOSwMzVTxANQ/s-l1600.jpg I am not sure if this entire URL is what you are getting back from your request. Another note, the L1600 images always say they are native 1600 x 1600 which may indicate there is a link between the naming convention and the resolution of the image. Maybe this will give you a string to pull on. – Nate M. Mar 29 '16 at 14:14
  • Thanks for your response Nate. This is an example picture URL I am getting back: i.ebayimg.com/00/s/ODAwWDYyOQ==/z/3eEAAOSwSdZWdJRL/$_1.JPG?set_id=880000500F I'm not sure if or how I can manipulate this URL to pass back the 1600 x 1600. Your method is actually covered in another stackoverflow thread I remember seeing. – bmills Mar 30 '16 at 22:49
  • 1
    It appears that when you iterate the number in front of .jpg, it changes the image. Million dollar question would be if it is consistent. Try the following: http://i.ebayimg.com/00/s/ODAwWDYyOQ==/z/3eEAAOSwSdZWdJRL/$_3.JPG – Nate M. Mar 30 '16 at 22:55
  • 1
    Just a note, the images appear to go all the way up to 100 (at least) I'm not entirely sure if the differences are consistent but.. If they are, then you should be able to take your response, replace the 1 with a 3 (or whatever ends up being the highest resolution) and the go grab that jpg. – Nate M. Mar 30 '16 at 22:56
  • [Similar thread](http://stackoverflow.com/questions/28489975/channel-advisor-ebay-image-quality-issue) – Nate M. Mar 30 '16 at 22:58
  • Oh my god I swear I tried this...but I guess not!! Nate you are the man. Thank you so much you don't know how frustrating this has been (I first started by scraping ebay with nightmarejs with so many issues). – bmills Mar 31 '16 at 03:57
  • Glad to hear we got the problem worked out! – Nate M. Mar 31 '16 at 23:49

1 Answers1

1

Just to clarify the comments posted on this question:

To obtain a high resolution image associated with a product listing perform the following..

Utilize a GetSellerRequest as formatted below to obtain the picture URL from the Item Details:

var xml = '<?xml version="1.0" encoding="UTF-8"?>' +
       '<GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">' +
          '<RequesterCredentials>' +
            '<eBayAuthToken> <!-- my ebayAuthToken -->' +
          '</RequesterCredentials>' +
          '<UserID>samurai-gardens</UserID>' +
          '<StartTimeFrom>2016-01-01T23:35:27.000Z</StartTimeFrom>' +
          '<StartTimeTo>2016-02-01T23:35:27.000Z</StartTimeTo>' +
          '<DetailLevel>ItemReturnDescription</DetailLevel>' +
          '<Pagination ComplexType="PaginationType">' +
           '<EntriesPerPage>10</EntriesPerPage>' +
        '<PageNumber>1</PageNumber>' +
        '</Pagination>' +
        '</GetSellerListRequest>"';

This should product a URL such as the following:

i.ebayimg.com/00/s/ODAwWDYyOQ==/z/3eEAAOSwSdZWdJRL/$_1.JPG?set_id=880000500F

Once this URL is obtained, it needs to be modified to point to the high resolution image option. Through trial and error this appears to be either .JPG images 3 or 57 (and possibly others). Each image has different alignments which is the cause of the multiple 'high resolution' options. Modify the returned URL using standard string manipulation techniques to obtain the following:

i.ebayimg.com/00/s/ODAwWDYyOQ==/z/3eEAAOSwSdZWdJRL/$_3.JPG

This could be obtained as follows (in c#). The snippet below was not tested. Make sure there isn't an off by one bug in the substring. There are a myriad way of doing this, this just happens to be what I thought of..

string url = "i.ebayimg.com/00/s/ODAwWDYyOQ==/z/3eEAAOSwSdZWdJRL/$_1.JPG?set_id=880000500F";
int index = url.LastIndexOf(Convert.ToChar(@"/");
url = url.Substring(0,index+1);
url = url + @"/$_3.JPG";

If you are using c# (which I realize the original post was for javascript) you can use information in the following thread to obtain an image stream from the URL: URL to Stream

Here is a post for displaying an image from URL using Javascript: URL To Display Javascript

Community
  • 1
  • 1
Nate M.
  • 822
  • 6
  • 14
  • There is an interesting unofficial explanation of what the magic numbers mean here: https://forums.developer.ebay.com/questions/12284/get-larger-images-via-getmultipleitems-call-option.html#answer-12740 – jthompson Jan 04 '18 at 14:54