Search code examples
facebookmediawikiwikipediawikipedia-apimediawiki-api

What API does facebook use for displaying the full Wikipedia articles?


I couldn't find any api that return the article in a usable HTML form. Most of them return extracts which have very poor HTML formatting which makes them useless for anything.


Solution

  • There is no way to tell what Facebook did exactly, but the easiest way to grab the HTML contents of an article is by using the render action, i.e. by appending action=render to the URL:

    https://en.wikipedia.org/wiki/Cooking?action=render

    This produces the exact same HTML you can see on Wikipedia, but omits the non-content part (sidebar etc). If you need to reproduce the layout of an article more faithfully, you need to reuse parts of Wikipedia's CSS, and there is no easy way to do that.