Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatic access to Amazon Wishlist?

Amazon recently changed their APIs which and it seems there's no way now to access my WishList on Amazon programmatically using these APIs. Anybody knows any way to do it besides screen-scraping? Maybe some third-party service (I don't mind working with only public data)?

like image 824
StasM Avatar asked Dec 31 '10 05:12

StasM


People also ask

How do I make my Amazon Wish List discrete?

To change your Amazon wish list settings, open up Amazon on the web, hover over Account & Lists and click Wish List. On this page, click “List settings” in the top right corner. Next to your Wish List (or any list you want to edit), click the drop down under Privacy and click Private.

Can you make a collaborative Wish List on Amazon?

Click on the list you want to share. Click the Invite button above your list. Copy the link, or click Invite by email to open your email client. Send the link to the person you want to collaborate with.

Are Amazon wish lists public?

To change your Custom Gift List privacy settings: Go to Custom Gift List and select the Custom Gift List you'd like to change. Select Settings. Under Your gift list privacy, select the option you prefer (Public, Shareable, or Private).

Can people see your address if they order off your Amazon Wish List?

On your Wish List, your address is kept confidential. The only information that appears when someone purchases something from you is your name and city. When someone buys a gift from your Wish List, they will never see your full address.


1 Answers

For screen scraping, the compact layout style might be helpful: http://bililite.com/blog/2010/10/31/hacking-my-way-to-an-amazon-wishlist-widget/

Update

I did some hacking of my own in google spreadsheets and managed to get 2 basic implementations working.

Using Google Apps Scripts:

Type your wishlist ID into cell A1. Copy and paste the following into a google apps script (Tools > Scripts > Scripts Editor), and run the getWishlist function:

function getWishlist(){   var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];   var wishlistId = sheet.getRange('a1').getValue();    var response = UrlFetchApp.fetch("http://www.amazon.co.uk/registry/wishlist/" + wishlistId + "?layout=compact").getContentText();   var asinRegex = /name="item.([\d]+)\.(?:[A-Z0-9]+).([A-Z0-9]+).*/g   while (match = asinRegex.exec(response)) {     var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];     var rowIndex = Number(match[1])+2;     var asin = match[2];     setRow(sheet, rowIndex, asin);     var offers = UrlFetchApp.fetch("http://www.amazon.co.uk/gp/offer-listing/" + asin).getContentText();         setRow(sheet, rowIndex, asin,             getFirstMatch(/class="producttitle">(.+)</g, offers),            getFirstMatch(/class="price">(.+)</g, offers));   }     Browser.msgBox("Finished"); }  function getFirstMatch(regex, text) {   var match = regex.exec(text);   return (match == null) ? "Unknown" : match[1]; }  function setRow(sheet, index, a, b, c) {   sheet.getRange('a' + index).setValue(a);   sheet.getRange('b' + index).setValue(b);   sheet.getRange('c' + index).setValue(c); } 

​ ​ NB, I'm having some probs with regex matching the title / price. Not sure why, but shows the basic idea.

Using Google Spreadsheet Functions

Type your wishlist ID into cell A1.

Type the following function into A2. It will populate the cell and all below it with the id strings for each item in your wishlist:

=importXML("http://www.amazon.co.uk/registry/wishlist/"&A1&"?layout=compact", "//*[starts-with(@name, 'item.')]/@name") 

Type the following function into B2, which will extract the asin from the id string:

=right(A2, 10) 

Type the following function into B3, which will fetch the offer listing for the asin in B2 and display the title:

=importXML("http://www.amazon.co.uk/gp/offer-listing/"&B2, "//h1") 

Type the following function into B4, which will fetch the offer listing for the asin in B2 and display all the prices:

=concatenate(importXML("http://www.amazon.co.uk/gp/offer-listing/"&B2, "//span[@class='price']")) 
like image 76
robd Avatar answered Oct 06 '22 06:10

robd