모조리 Data/모조리 R

4. rvest 라이브러리를 통해 웹 텍스트 스크래핑해오기

JoeSung 2017. 7. 15. 17:17





## rvest를 통한 웹 스크래핑


install.packages("xml2")

library("xml2")

library("rvest")


url_tvcast = "http://tvcast.naver.com/jtbc.youth"

html_tvcast = read_html(url_tvcast, encoding = "UTF-8")


html_tvcast %>% html_nodes(".title a")

html_tvcast %>% html_nodes(".title a") %>% html_text()

tvcast_df = html_tvcast %>% html_nodes(".title a") %>% html_text() %>%

data.frame()


반응형