English 中文(简体)
Linking to Wikipedia abstracts (the way Google Earth does it) [duplicate]
原标题:

I m embedding Wikipedia pages in my app, and I d like to show the same simplified abstract that Google Earth shows. (It gives the first several paragraphs and a link to the full content, without any serious layout.)

I know about the printable=true option, but that s not what I m looking for.

最佳回答

You might want to consider using the API : you can grab a "text" version of any article. Afterwards, it is up to you to extract the summary.

Another option is just to request the page in raw format:

Raw (Wikitext) page processing: sending a action=raw or a action=raw&templates=expand GET request to index.php will give the unprocessed wikitext source code of a page.

E.g.

http://en.wikipedia.org/wiki/Main_Page?action=raw

Of course you ll need to do a bit a scraping. Going through the API might prove more efficient as you have better control of what you can pull from the database directly (wikitext if you wish).

问题回答

Did you look at the Wikipedia API? Mediawiki (and so Wikipedia) has a feature-rich and flexible API which is documented on http://www.mediawiki.org/wiki/API

Use the mediawiki API with action=query and prop=revisions to fetch a given revision , remove the wikitext ( images, infoboxes) and extract the content of the first sentence.





相关问题
Google maps and Google earth application

I want to develop an application to find the value of a property based on some constants(such as the distance from the shore,the width of the road in frond of the property,the neighborhood that is ...

Overlay Google Maps Normal tiles in the Google Earth Api

I m not sure if this is possible, but I would like to overlay the Normal Google Map Tiles(type: G_NORMAL_MAP) inside of the Google Earth Web Api. The satellite maps have too inconsistent of contrast ...

Google Earth API vs Google Earth COM API

I want to use Google Earth in a desktop application. My question is which one of these two APIs provided by google do you think has more functionality and/or best support? Thank you very much

热门标签