html
From rvest v0.3.2
by Hadley Wickham
Parse an HTML page.
html is deprecated: please use read_html
() instead.
- Keywords
- deprecated
Usage
html(x, ..., encoding = "")# S3 method for response
read_xml(x, ..., encoding = "", as_html = FALSE)
# S3 method for session
read_xml(x, ..., as_html = FALSE)
Arguments
- x
A url, a local path, a string containing html, or a response from an httr request.
- ...
If
x
is a URL, additional arguments are passed on toGET()
.- encoding
Specify encoding of document. See
iconvlist()
for complete list. If you have problems determining the correct encoding, trystri_enc_detect
- as_html
Optionally parse an xml file as if it's html.
Examples
library(rvest)
# NOT RUN {
# From a url:
google <- read_html("http://google.com", encoding = "ISO-8859-1")
google %>% xml_structure()
google %>% html_nodes("div")
# From a string: (minimal html 5 document)
# http://www.brucelawson.co.uk/2010/a-minimal-html5-document/
minimal <- read_html("<!doctype html>
<meta charset=utf-8>
<title>blah</title>
<p>I'm the content")
minimal
minimal %>% xml_structure()
# From an httr request
google2 <- read_html(httr::GET("http://google.com"))
# }
Community examples
Looks like there are no examples yet.