O'Reilly logo

XML Hacks by Michael Fitzgerald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Syndicate a List of Books from Amazon with RSS and ASP

Someday all data will be available as RSS. Get a head start by syndicating Amazon search results.

With the wide audience for RSS data, just about everything is being turned into an RSS feed. This hack turns any Amazon Web Services (AWS) query result into an RSS feed.

What You Need

This hack uses ASP, which runs on Windows servers running IIS. The logic is straightforward, though, and could be translated to any scripting language. You also need an Amazon developer token and an Amazon associates tag, both available from http://www.amazon.com/associates.

The Code

The file amazon_rss.asp is in the file archive for the book. Be sure to change the Const declarations to match your setup.

<%
'' AMAZON-RSS.ASP
'' Sean P. Nolan
'' http://www.yaywastaken.com/
''
'' This code is free for you to use as you see fit. Copy it, rewrite it, 
'' run it yourself, whatever. But no warranties or guarantees either. Who
'' knows what the hell it does. Not me, that's for sure!
''
'' Generates an RSS 0.91 feed from an Amazon book query
''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Const MAX_PAGES_DEFAULT = 10
    Const DEV_TOKEN = "insert developer token"
    Const AFFILIATE_CODE = "insert associate tag" Const XSL_FILE = "amazon_lite.xsl" 'change to heavy for more info. Dim szTitle, szMaxPages, nMaxPages Response.ContentType = "text/xml" Server.ScriptTimeout = 60 * 4 ' 4-minute maximum Response.Expires = 0 szMaxPages = Request.QueryString("maxpages") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required