Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205491

R html_nodes() function giving error Unexpected character '$'

$
0
0

I am trying to extract financial data from Yahoo Finance. When I am running, it is giving error

"Error in tokenize(css) : Unexpected character '$' found at position 19"

urlYCashflow <- "https://au.finance.yahoo.com/quote/MSFT/cash-flow?p=MSFT"
webpageYCashflow <- read_html(urlYCashflow)
node1 <- webpageYCashflow %>%
      html_nodes('D(tbr).fi-row.Bgc($hoverBgColor):h') %>%
      html_text()    

Is there any way to avoid $ by replacing it in XML document or any other suggestion, please? I also tried xpath tag but every time result is character(0).

    node1 <- webpageYCashflow %>%
      html_nodes(xpath = '//*[@id="Col1-1-Financials-Proxy"]/section/div[3]/div[1]/div/div[2]/div[7]/div[2]/div[3]/div[1]/div[2]/span') %>%
      html_text()

Viewing all articles
Browse latest Browse all 205491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>