Learn R Programming

WikipediR (version 1.3.0)

page_links: Retrieve a page's links

Description

page_links, when provided with a page title, retrieves internal wikilinks from the current revision of that page.

Usage

page_links(language = NULL, project = NULL, domain = NULL, page,
  limit = 50, direction = "ascending", namespaces = NULL,
  clean_response = FALSE, ...)

Arguments

language
The language code of the project you wish to query, if appropriate.
project
The project you wish to query ("wikiquote"), if appropriate. Should be provided in conjunction with language.
domain
as an alternative to a language and project combination, you can also provide a domain ("rationalwiki.org") to the URL constructor, allowing for the querying of non-Wikimedia MediaWiki instances.
page
the title of the page you want the links of.
limit
the number of links to retrieve. 50 by default; a maximum of 500 is set server-side.
direction
the direction to order the links in, by destination page ID: "ascending" or "descending". Set to "ascending" by default.
namespaces
The namespaces to filter to. By default, links to any namespace are retrieved: alternately, a numeric vector of accepted namespaces (which are described https://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces{here}) can be provide
clean_response
whether to do some basic sanitising of the resulting data structure. Set to FALSE by default.
...
further arguments to pass to httr's GET.

Examples

Run this code
#Links
links <- page_links("en","wikipedia", page = "Aaron Halfaker")

#Namespace-specific links
mainspace_links <- page_links("en","wikipedia", page = "Aaron Halfaker", namespaces = 0)

Run the code above in your browser using DataLab