query_generate_pages {wikkitidy}R Documentation

Generate pages that meet certain criteria, or which are related to a set of known pages by certain properties

Description

Many of the endpoints on the Action API can be used as generators. Use list_all_generators() to see a complete list. The main advantage of using a generator is that you can chain it with calls to query_page_properties() to find out specific information about the pages. This is not possible for queries constructed using query_list_pages().

Usage

query_generate_pages(.req, generator, ...)

list_all_generators()

Arguments

.req

A httr2_request, e.g. generated by wiki_action_request

generator

The generator module you wish to use. Most list and property modules can be used, though not all.

...

<dynamic-dots> Additional parameters to the generator

Details

There are two kinds of generator: list-generators and prop-generators. If using a prop-generator, then you need to use a query_by_() function to tell the API where to start from, as shown in the examples.

To set additional parameters to a generator, prepend the parameter with "g". For instance, to set a limit of 10 to the number of pages returned by the categorymembers generator, set the parameter gcmlimit = 10.

Value

query_generate_pages: The modfied request, which can be passed to next_batch or retrieve_all as appropriate.

list_all_generators: a tibble of all the available generator modules. The name column gives the name of the generator, while the group column indicates whether the generator is based on a list module or a property module. Generators based on property modules can only be added to a query if you have already used query_by_ to specify which pages' properties should be generated.

Examples

# Search for articles about seagulls
seagulls <- wiki_action_request() %>%
  query_generate_pages("search", gsrsearch = "seagull") %>%
  next_batch()

seagulls

[Package wikkitidy version 0.1.12 Index]