clessn / nytapi

Get data from the New York Times API
Other
1 stars 0 forks source link

Get most popular articles #23

Open judith-bourque opened 1 year ago

judith-bourque commented 1 year ago
judith-bourque commented 1 year ago
#' Look up articles by keywords
#'
#' `r lifecycle::badge('experimental')`
#'
#' @param query Search query
#' @param filter Search filters
#' @param ... Other things to pass onto query
#' @param key API key
#'
#' @return HTTR response
#' @export
search_articles <- function(query = NULL, filter = NULL, ..., key = NULL){

  create_req() |>
    httr2::req_url_path_append("/mostpopular/v2") |>
    httr2::req_url_query(!!!params) |>
    nytapi::add_user_agent() |>
    httr2::req_throttle(5/60) |>
    httr2::req_perform()

}