See API:Lists for available
list actions. Each list action returns a list of pages, typically including
their pageid, namespace
and title. Individual lists have particular properties that can be requested,
which are usually prefaced with a two-word code based on the name of the
list (e.g. specific properties for the categorymembers
list action are
prefixed with cm
).
Arguments
- .req
A httr2_request, e.g. generated by
wiki_action_request
- list
The type of list to return
- ...
<
dynamic-dots
> Additional parameters to the query, e.g. to set configure list
Details
When the request is performed, the data is returned in the body of the
request under the query
object, labeled by the chosen list action.
If you want to study the actual pages listed, it is advisable to retrieve the pages directly using a generator, rather than listing their IDs using a list action. When using a list action, a second request is required to get further information about each page. Using a generator, you can query pages and retrieve their relevant properties in a single API call.
Examples
# Get the ten most recently added pages in Category:Physics
physics_pages <- wiki_action_request() %>%
query_list_pages("categorymembers",
cmsort = "timestamp",
cmdir = "desc", cmtitle = "Category:Physics"
) %>%
gracefully(next_batch)
physics_pages
#> <complete/query_tbl>
#> ℹ There are more results on the server. Retrieve them with `next_batch()` or `retrieve_all()`
#> ✔ Data complete for all records
#> # A tibble: 10 × 3
#> pageid ns title
#> <int> <int> <chr>
#> 1 844186 0 Modern physics
#> 2 37468090 14 Category:Modern physics
#> 3 37358141 14 Category:Physics-related lists
#> 4 694942 14 Category:Physicists
#> 5 75105818 14 Category:Eponyms in physics
#> 6 63332556 14 Category:Works about physics
#> 7 1996857 0 Nucleation
#> 8 21276538 0 Surface stress
#> 9 14647723 0 Disclination
#> 10 76197486 0 Shockwave cosmology