Created
November 1, 2017 12:25
-
-
Save trinker/d288d83a2d5de16d2c670dd876d6baa3 to your computer and use it in GitHub Desktop.
Scraping Minimal Example w/ Robots.txt Checking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!require("pacman")) install.packages("pacman") | |
| pacman::p_load(robotstxt, dplyr, xml2, rvest) | |
| path <- 'https://www.fluentu.com/blog/english/basic-english-phrases/' | |
| paths_allowed(path) | |
| path %>% | |
| xml2::read_html() %>% | |
| rvest::html_nodes('h4') %>% | |
| rvest::html_text() %>% | |
| {gsub('^\\S+\\s+', '', .)} %>% | |
| paste(collapse = '\n') %>% | |
| cat() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment