https://github.com/hadley/web-scraping
https://github.com/hadley/web-scraping
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hadley/web-scraping
- Owner: hadley
- Created: 2024-03-04T15:08:07.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-07-08T08:25:36.000Z (8 months ago)
- Last Synced: 2025-01-07T08:00:09.000Z (about 2 months ago)
- Language: R
- Size: 19.7 MB
- Stars: 75
- Watchers: 2
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - hadley/web-scraping - (R)
README
# Web scraping with rvest (UseR 2024)
In this tutorial, you'll learn the basics of web scraping with R, using the rvest package. We'll discuss the basic structure of an HTML page, and how to find the elements your interested in with selectorgadget or the browser's developer tools. You'll then learn how to programmatically extract with rvest, turning web pages into tidy data frames.
Bonus content includes scraping multiple pages (with rvest and httr2), scraping dynamic sites where content is generated with JavaScript, extracting data from unofficial APIs, and some hints on using LLMs.
[Slides](rvest.pdf)
## Requirements
To run the code at home, install the following packages:
```R
# install.packages("pak")
pak::pak(c("tidyverse", "chromote"))
```To run the live web-scraping code you'll also need a copy of [Chrome](https://www.google.com/chrome/) installed on your computer.