#WikipediR: A MediaWiki API client library Many websites run on versions of MediaWiki, most prominently Wikipedia and its sister sites. WikipediR is an API client library that allows you to conveniently make requests for content and associated metadata against MediaWiki instances.
“content” can mean a lot of different things - but mostly, we mean
the text of an article, either its current version or any previous
versions. Current versions can be retrieved using
page_content
, which provides both HTML and wikitext as
possible output formats. Older, individual revisions can be retrieved
with revision_content
. These functions also return a range
of possible metadata about the revisions or articles in question.
Diffs between revisions can be generated using
revision_diff
, while individual ‘’elements’’ of a page’s
content - particularly links - can be extracted using
page_links
, page_backlinks
, and
page_external_links
. And if the interest is in changes to
content, rather than content itself, recent_changes
can be
used to grab a slice of a project’s Special:RecentChanges feed.
Page-related information can be accessed using
page_info
, while categories that a page possesses can be
retrieved with categories_in_page
- the inverse of this
operation (what pages are in a particular category?) uses
pages_in_category
.
User-related info can be accessed with user_information
,
while user_contributions
allows access to recent
contributions by a particular user: this can be conveniently linked up
with revision_content
, mentioned above, to retrieve the
content of the last N edits by a particular editor, or metadata about
those edits.