Code
<- Sys.getenv("GUARDIAN_API")
api_key
<- "https://content.guardianapis.com/"
base <- "search"
path = list(
query tag = "world/series/russia-ukraine-war-at-a-glance",
`api-key` = api_key,
`page-size` = 50,
`show-fields` = "trailText,headline,body"
)
<- httr::GET(base, path = path, query = query)
req <- httr::content(req)
back
<- back$response$results |>
page1 ::map_df(~t(unlist(.x)) |> dplyr::as_tibble())
purrr
<- back$response$pages
pages <- purrr::map(2:pages, ~{
other_pages $page = .x
query<- httr::GET(base, path = path, query = query)
req <- httr::content(req)
back $response$results |>
back::map_df(~t(unlist(.x)) |> dplyr::as_tibble())
purrr
})
<- page1 |> dplyr::bind_rows(other_pages |>
pages ::bind_rows())
dplyr#write.csv()