|
How can I create predefined Amazon search links?I read your note about how to add an Amazon.com search box to your site and it's very cool, but what I want to know is: What if I want the search to only search a certain keyword, Example "Honda Parts"? Of all the major sites that I visit with frequency, there are non with a more Byzantine URL structure and organization than Amazon.com. I don't know what kind of back-end infrastructure decision they made years ago, but the whole "obidos" and session number thing really makes it a huge pain to work with the site, and forget about being able to email someone a URL so they can see a product for sale: their URLs are famously bizarre. But! Don't panic! When it comes to their search system, buried in all the junk, there is a parameter that contains the actual search string, so when I go to Amazon.com and simply search for "honda parts" from the home page, the resultant page has the following URL: http://www.amazon.com/s/ref=nb_ss_gw/102-1882688-6100927?
initialSearch=1&url=search-alias%3Daps&field-keywords=honda+parts&Go.x=0&Go.y=0&Go=Go Now it's just a matter of slicing until it fails: what parameters can we axe from this ghastly URL until we get just what we want? The way I do this is to actually edit the URL within the Address box of my browser (Apple's Safari) and reload the page each time until it just doesn't bring up what I seek. Do that and you'll quickly find that all the "Go" fields can be safely chopped off. Can we delete the url=search-alias%3Daps value? ![]() Clearly not. We've ended up with a search that has no category specified, but the Amazon backend can't extrapolate a full-site search. Bummer. How about the core URL? Can we tweak that a bit, losing the nb_ss_gw and/or the 102-1882688 jazz? Surprisingly, yes, you can get rid of the numeric session ID value without breaking the search, something that's a bit confusing if you're used to all parameters being name=value pairs after the "?" symbol. You can even get rid of the ref= part of the URL, believe it or not. Lots of superfluous information in this search URL, as is obvious. Heck, you can even get rid of the "first-search" value, leaving us with a much less scary URL: http://www.amazon.com/s?url=search-alias%3Daps&field-keywords=honda+parts
Doesn't even need a line break. Better, you can now see how to add it to your site and how to use it as the wrapper for a button, say: <a href="http://www.amazon.com/s?url=search-alias%3Daps&field-keywords=honda+parts"><img
src="amazon-search-honda.jpg" alt="Search for Honda parts at Amazon" /></a> or just as a hypertext link unto itself: <a href="http://www.amazon.com/s?url=search-alias%3Daps&field-keywords=honda+parts">Check Amazon.com for Honda parts</a>
Hope that helps you work with the Amazon search engine!
Categorized:
CGI Scripts and Web Site Programming
(Article 7607,
Written by Dave Taylor)
Tagged: amazon.com, cgi programming, search engines Previous: Can I add a photo to my LinkedIn profile? Next: Dealing with a non-paying deadbeat buyer on eBay? Subscribe!
Great post, very helpful. Is it possible to add in an Amazon Associates ID so I can get credit for links I send their way? ® Posted by: Richard Holt at March 6, 2008 2:53 PMGreat article... Hi, In my site i am listing song names, and there is a link corresponding to each song which redirects to amazon. Currently i am searching the song name in amazon, so i have only one field-keyword. How Can i provide a search using artist name too. required search by song and artist... plz help Regards, Navigate to the amazon book desired. Click on "share" link. Copy permalink and paste into your article. Posted by: Bill Talada at September 26, 2010 8:24 AMHi, Thank You! You made life lot easier. Posted by: Bobby at October 30, 2011 1:55 AMI have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help WordPress Help |