Web Scraping in R
Timo Grossenbacher
Instructor
h1 {
color: red;
}
p {
font-style: italic;
}
<html>
<body>
<h1>Welcome to Web Scraping!</h1>
<p>Be it in R, Python or any
other language -
scraping is fun!</p>
</body>
</html>
h1 {
color: green;
}
p {
font-style: italic;
}
h1, p {
font-family: sans-serif;
}
...
<h1>Another CSS example.</h1>
<p>Some text.</p>
...
html %>% html_elements('h1, p')
{xml_nodeset (2)}
[1] <h1> Another CSS ex...
[2] <p>Some text</p>
type { key: value; }
html %>% html_elements('type') # e.g. 'h1' or 'a' or 'span'
type1, type2 { key: value; }
html %>% html_elements('type1, type2')
* { key: value; }
html %>% html_elements('*')
Web Scraping in R