ivanTheTerrible
ivanTheTerrible

Reputation: 2856

Best practices for parsing HTML from Wikipedia for iPhone viewing?

I am building an iPhone Wikipeida game app, that requires modifying the default Wiki HTML a little bit (mostly simplifying the page).

So far I am directly downloading the HTML output from en.wikipedia.org/wiki/Article_Foo to a python Google App Engine, and then modify its CSS and HTML structure, cache it, and finally output to iPhone. It works but I find this method quite tedious, there must be a better method?

Please note that I use App Engine not just for parsing the Wiki, but the game also requires it to keep the stores...etc, hence not a overkill. Also, I would prefer doing all the work with python on App Engine, to keep the iPhone client as thin and mobile as possible (XML on iPhone is a big no fun)

Thanks a lot.

=======

Nick mentions why not use the mobile Wiki which already optimizes for iPhone. However, the issue is that it goes down quite frequently (every couple weeks or so), also its HTML structure changes quite frequently too.

Upvotes: 0

Views: 643

Answers (3)

lambshaanxy
lambshaanxy

Reputation: 23062

You can set up your own copy of the server used by m.wikimedia.org:

http://github.com/hcatlin/wikimedia-mobile

It's written in Ruby, but this shouldn't be an issue if your app just uses the HTML output.

Upvotes: 0

Nick Johnson
Nick Johnson

Reputation: 101149

Why not just fetch the mobile version of the page from http://en.m.wikipedia.org/? This is already formatted for mobile devices.

Upvotes: 0

jbochi
jbochi

Reputation: 29654

You can use the MediaWiki API to download the markup text and use some API tools for Python that could make the process/modify work easier.

Caching and outputting to iPhone is fine. I believe there is not much to simplify here.

Upvotes: 2

Related Questions