read_memento: Read a resource directly from the Time Travel MementoWeb

Description Usage Arguments Details Value References Examples

View source: R/mementoweb.r

Description

This uses the MementoWeb Time Travel Service to directly retrieve retrieve URL content. You get (slightly augmented by MementoWeb) orignal URL content from at or near the timestamp you specify.

Usage

1
2
read_memento(url, timestamp = format(Sys.Date(), "%Y"), as = c("text",
  "raw", "parsed"))

Arguments

url

URL to retrieve information for

timestamp

timestamp to use when checking for availability.If you don't pass in a valid R "time-y" object, you will need to ensure the character string you provide is in a valid subset of YYYYMMDDhhmmss.

as

How you want the content returned. One of "text", "raw" or "parsed" (it uses httr::content() to do the heavy lifting).

Details

This can be helpful if you find the resource you need is gone today but still exists in the memory of the internet.

Value

The specified content type

References

Time Travel API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
library(htmltools)
library(rvest)

yahoo_old <- read_memento("http://yahoo.com", "2010")

html_print(HTML(yahoo_old)) # opens browser

pg <- xml2::read_html(yahoo_old)
html_nodes(pg, "a.x3-large") %>%
  html_text()
## Tiger loses one more sponsorship"

## End(Not run)

hrbrmstr/wayback documentation built on May 17, 2019, 5:53 p.m.