R을 이용한 웹 크롤링

    install.packages("rvest") install.packages("httr") library(rvest) library(httr) url <- 'http://www.cine21.com/news/list/?idx=1&p=' agent_nm <- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0" a_titles = c() a_contents =c() title_end <- list() #a.linksurl <- list() news_cont_end <- list() for (i in 1:3){ a_url <- paste0(url, i) a_url2 <- html(a_url) a_titles <- html_nodes(a_url2, "span.tit") a_title_read <- repair_encoding(html_text(a_titles)) title_end <- c(title_end, a_title_read) a.links <- html_nodes(a_url2, 'ul.news li') a.links <- html_nodes(a.links, 'a') a.links <- html_attr(a.links, 'href') a.main <-

Top