I’m going through the Wikitravel API and I noticed that the XML file that they provide just lumps all of the information together in a big blob. Example: http://wikitravel.org/en/Special:Export/San_Francisco
Is there any way to obtain trees with the specific headings (e.g. Understand, Get In, Get Around, etc.) instead?
You can use
action=parsefrom the MediaWiki API to do this.For example, the query http://wikitravel.org/wiki/en/api.php?format=xml&action=parse&prop=sections&page=San%20Francisco will return something like:
From this, you can reconstruct the section tree.