wiki_action_request {wikkitidy}R Documentation

Query Wikipedia using the MediaWiki Action API

Description

Wikipedia exposes a To build up a query, you first call wiki_action_request() to create the basic request object, then use the helper functions query_page_properties(), query_list_pages() and query_generate_pages() to modify the request, before calling next_batch() or retrieve_all() to perform the query and download results from the server.

Usage

wiki_action_request(..., action = "query", language = "en")

Arguments

...

<dynamic-dots> Parameters for the request

action

The action to perform, typically 'query'

language

The language edition of Wikipedia to request, e.g. 'en' or 'fr'

Details

wikkitidy provides an ergonomic API for the Action API's Query modules. These modules are most useful for researchers, because they allow you to explore the stucture of Wikipedia and its back pages. You can obtain a list of available modules in your R console using list_all_property_modules(), list_all_list_modules() and list_all_generators(),

Value

An action_api object, an S3 list that subclasses httr2::request. The dependencies between different aspects of the Action API are complex. At the time of writing, there are five major subclasses of action_api/httr2_request:

Examples

# List the first 10 pages in the category 'Australian historians'
historians <- wiki_action_request() %>%
  query_list_pages(
    "categorymembers",
    cmtitle = "Category:Australian_historians",
    cmlimit = 10
  ) %>%
  next_batch()
historians

[Package wikkitidy version 0.1.12 Index]