Home > wikipedia-names-your-band

wikipedia-names-your-band

Wikipedia-names-your-band is a project mainly written in PYTHON and JAVASCRIPT, it's free.

Wikipedia Names Your Band

h1. Wikipedia Names Your Band

A little application I wrote to help teach myself a bit about "Google App Engine":http://code.google.com/appengine/. It fetches all the pieces you need to make a random album cover according to the "Wikipedia Names Your Band" "meme":http://www.buzzfeed.com/peggy/wikipedia-names-your-band. To deploy your own copy, you'll have to change the Google AJAX Feed API key and the Google Analytics tracking code at the bottom of the HTML files, and change the _export and _close_target parameters in index.js.

It uses jQuery to send requests to the "Wikipedia":http://en.wikipedia.org/w/api.php and "Flickr":http://www.flickr.com/services/api/, "is.gd":http://is.gd/api_info.php, and "Picnik":http://www.picnik.com/info/api APIs. I also learnt just enough Python to write a simple proxy fetch.py, since "The Quotations Page":http://www.quotationspage.com/random.php3 doesn't have an API, and I can't fetch its HTML directly with jQuery without getting an "Access to restricted URI denied" exception. Update: The current version uses only JavaScript to fetch the quotation from "QuoteDB":http://quotedb.com/ instead, since I can use the "Google AJAX Feed API":http://code.google.com/apis/ajaxfeeds/ to fetch QuoteDB's "random quotation RSS":http://www.quotedb.com/random_quotes_generator as JSON.

I ran into some gotchas on Google App Engine. No Python library with C extensions is available, so lxml and others are out. Of the libraries that do run on Google App Engine, html5lib seems to be the only one that doesn't choke on malformed HTML (did you know that inline JavaScript must be in a CDATA(character data) section for the HTML to validate?). Also, App Engine caches the results of urllib2.urlopen, so if you are going to request a dynamic page often, put a random number in the query string to get around App Engine's aggressive caching.

Previous:telesongs