kr.Investing.com 05_17

김오왼·2022년 5월 17일
0


kr.investing_0517<- c()
news_href <- c()

for (pageNo in 1) {
  urls <- paste0("https://kr.investing.com/news/stock-market-news/",pageNo)
  get_url <- GET(urls)
  html_source <- read_html(get_url)
  my_nodes <- html_nodes(html_source,".textDiv > a.title")
  my_href <- html_attr(my_nodes,"href")
  news_href <- paste0("https://kr.investing.com",my_href) 
  for (i in 1:36) { 
  
    T.selector <- paste0("#leftColumn > div.largeTitle > article:nth-child(",i,") > div.textDiv > a")
    title_nodes <- html_nodes(html_source,T.selector)
    text_title <- html_text(title_nodes)
    kr.investing_0517 <- c(kr.investing_0517,text_title)
  }
} 
kr.investing_0517_df <- data.frame(kr.investing_0517)
href_df <- data.frame(news_href)
kr.investing_0517_df
profile
전문 금융인을 목표로하는 김야옹야옹이

0개의 댓글