Web Scraping di R
Timo Grossenbacher
Instructor
<html>
<body>
<h2>Contoh pertama</h2>
<p>Sebuah paragraf teks.</p>
<p>
Berikut daftar:
</p>
</body>
</html>


...
<div>
Berikut daftar:
<ul>
<li>Butir 1</li>
<li>Butir 2</li>
<li>Butir 3</li>
</ul>
</div>
...

...
<p>
Berikut adalah sebuah
<a href="https://google.com">tautan</a>.
</p>
...
library(rvest)
html <- read_html(html_document)
html
{html_document}
<html>
[1] <body> \n <h2>Contoh pertama</h2>\n <p>Sebuah paragraf teks.</p>\n ...
class(html)
"xml_document" "xml_node"
library(xml2)
xml_structure(html)
<html>
<body>
{text}
<h2>
{text}
{text}
<p>
{text}
{text}
<p>
{text}
<a [href]>
{text}
{text}
{text}
Web Scraping di R