Labels

tools (7) programming (5) cluj (4) misc (4) rails (4) productivity (3) startups (3) internet (2) meetup (2) software (2) emberjs (1) hack (1) science (1) zencash (1)

Tuesday, September 8, 2015

Get your Amazon WishList with a UNIX one liner

I was trying to export my entire Amazon WishList. Which is actually my reading list. The web version displays only 10 entries per page, and they deprecated their API endpoint for retrieving wish lists. Other solutions that I found online seemed clunky so I set out to find the simplest way of doing it.



I noticed that the mobile app displays the entire wishlist so I installed it on Andyroid, and started poking around to see if I could find the endpoints it was using. Luckily, I did. And I just appended some common parameters which can be found on other endpoints.








So if you want to fetch your wishlist in bulk, follow these steps:
1. Find your wishlist ID. You will find it in the address bar after you click the name of your desired wishlist.


2. Now, just fetch and parse it according to your needs. The combination of grep and sed will extract just the title.
curl https://www.amazon.com/gp/aw/ls/gp/aw/ls/\?lid\=WISHLIST_ID\&reveal\=unpurchased\&sort\=date-added\&ty\=wishlist\&p\=all | grep "\/gp\/aw\/d\/" | grep -o '>.*<' | sed 's/>\(.*\)</\1/'


So, what's on your reading list?