Scraping financial data from Yahoo! Finance

Viewed 258

I think Yahoo Finance updated their financial statement page, and code is not working any more. I think the "xpath" has changed and "p" is returning a list of zero. I can't find the "table" tag in the HTML code to update the xpath link.

# Collect the Income Statement data
        link <- "https://finance.yahoo.com/quote/"
        link <- paste0(link, stock[i], "/financials?p=", stock[i])
        wahis.session <- html_session(link)
        p <- wahis.session %>%
          html_nodes(xpath = '//*[@id="Col1-3-Financials-Proxy"]/section/div[3]/table')%>%
          html_table(fill = TRUE)
        IncomeStatement <- p[[1]]
0 Answers
Related