This script takes an APML feed, and parses it into valid APML-JSON based on the APML-JSON spec on the APML wiki. Instead of manually parsing the APML into JSON, I have used the XSLT file attached to the aforementioned spec page along with xsltproc
to generate the JSON data. The idea behind this script is based on John Resig’s RSS2JSON script.At the moment the script is pretty hacky for release, so I have provided a REST interface that can be accessed via a GET request.
A request to the interface would take the following form:
http://bmn.name/examples/apml2json/?url=URL&callback=CALLBACK
The callback parameter is optional. If specified, the resulting JSON is wrapped in the callback for easy parsing at the client end, otherwise the resulting JS Object is assigned to a variable which can be accessed via JS. The results from the call are cached hourly to reduce the load on the server. :)
Example Interface call: http://bmn.name/examples/apml2json/?
url=http://blog.bmn.name/index.php?apml=apml&callback=parseFeed
For more information on how to use the resulting JS, head over to John’s RSS2JSON page as he provides some sample JS.