Resolve a Wayback Machine snapshot URL (C++/libcurl)
Source:R/fetch_native.R
wayback_snapshot_url_native.RdQueries the Internet Archive “available” API for the closest
archived snapshot of url. C++ backend; supersedes the older
R-level resolver wayback_snapshot_url, which is kept for
the pure-R path and now parses with the package's own JSON codec.
Examples
# Input is validated before any network call:
try(wayback_snapshot_url_native("")) # empty url -> error
#> Error in wayback_snapshot_url_native("") : nzchar(url) is not TRUE
# \donttest{
# Uses the live Wayback service; degrades gracefully offline: any
# network failure returns NULL rather than erroring.
# Closest archived snapshot of a live page (or NULL if none archived).
wayback_snapshot_url_native("https://www.r-project.org/")
#> [1] "https://web.archive.org/web/20260911112635/https://www.r-project.org/"
# A shorter timeout for a quick lookup.
wayback_snapshot_url_native("https://cloud.r-project.org/", timeout = 10)
#> [1] "https://web.archive.org/web/20260825170116/https://cloud.r-project.org/"
# A never-archived URL returns NULL rather than erroring.
wayback_snapshot_url_native("https://example.invalid/never-archived")
#> NULL
# }