Choose properties to return for pages from the action API
Source:R/query-page-properties.R
query_page_properties.Rd
See API:Properties for a list of available properties. Many have additional parameters to control their behavior, which can be passed to this function as named arguments.
Arguments
- .req
A httr2_request, e.g. generated by
wiki_action_request
- property
The property to request
- ...
<
dynamic-dots
> Additional parameters to pass, e.g. to modify what is returned by the property request
Details
query_page_properties is not useful on its own. It must be combined with a
query_by_ function or query_generate_pages to specify which pages
properties are to be returned. It should be noted that many of the
API:Properties modules can
themselves be used as generators. If you wish to use a property module in
this way, then you must use query_generate_pages, passing the name of the
property module as the genenerator
.
Examples
# Search for articles about seagulls and retrieve their number of
# watchers
resp <- wiki_action_request() %>%
query_generate_pages("search", gsrsearch = "seagull") %>%
query_page_properties("info", inprop = "watchers") %>%
gracefully(next_batch) %>%
dplyr::select(pageid, ns, title, watchers)
resp
#> <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 × 4
#> pageid ns title watchers
#> <int> <int> <chr> <int>
#> 1 45232 0 Jonathan Livingston Seagull 149
#> 2 210481 0 Gull 178
#> 3 210492 0 Seagull (disambiguation) NA
#> 4 474370 0 The Seagull 76
#> 5 887152 0 Barbara Hershey 148
#> 6 2305766 0 British Seagull NA
#> 7 6386157 0 Seagull management 34
#> 8 12811837 0 Seagull Camera NA
#> 9 18537314 0 Seagull Trust Cruises NA
#> 10 73546753 0 BYD Seagull NA