Section 10.13. Having Amazon Produce Its Own RSS Feeds


10.13. Having Amazon Produce Its Own RSS Feeds

Andrew Odewahn, an editor at O'Reilly, spotted how you can have Amazon.com produce RSS feeds from any search within its own site. So, he says:

You could subscribe to a search for books on "software engineering," "Java," and "history of europe" to easily keep track with what's going on.

To do this, you only need play with a URL. The URL for an RSS 0.91 feed of a keyword search for "software engineering" is:

http://xml.amazon.com/onca/xml3?t=webservices-20&dev- t=amznRss&KeywordSearch=software%20engineering&mode=books&bcm=&typ e=lite&page=1&ct=text/xml&sort=+salesrank&f=http://xml.amazon.com/xsl/ xml-rss091.xsl

As you can see, this is actually calling the Amazon web services system and then formatting it by passing it through an XSLT stylesheet.

Andrew goes on to say,

By default, the search results are sorted by Amazon rank. After hacking around a bit, I found that you can change this default to any of a variety of other orders. For example, you can modify the feed so that books are sorted by publication date to get an automatically updated list of new books published on a particular topic.

To do this, scroll over the URL until you see the "&sort=+salesrank" part. To change the sort order, replace "salesrank" with the option you'd prefer. Here's a list of possible options found on Amazon's Web Services page, http://www.amazon.com/gp/aws/landing.html:

  • Publication Date daterank

  • Featured Items pmrank

  • Sales Rank salesrank

  • Customer reviews reviewrank

  • Price (Lo-Hi) pricerank

  • Price (Hi-Lo) inverse-pricerank

So, to get a feed of all the new books published in Software Engineering, just replace "salesrank" with "daterank" and click update. From now on, you easily see all the new stuff coming out in one place. For example:

http://xml.amazon.com/onca/xml3?t=webservices-20&dev- t=amznRss&KeywordSearch=Ben%20Hammersley&mode=books&bcm=&type=l ite&page=1&ct=text/xml&sort=+pricerank&f=http://xml.amazon.com/xsl/xml- rss091.xsl

produces a feed of the books I have written, in order of price. This technique highlights a very good point: it is well worth looking at complex URLs quite carefully: they're invariably hackable.



    Developing Feeds with RSS and Atom
    Developing Feeds with Rss and Atom
    ISBN: 0596008813
    EAN: 2147483647
    Year: 2003
    Pages: 118

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net