How do I extract a stock quote from a javascript enabled webpage? The link to the page is: https://www.tsp.gov/InvestmentFunds/FundPerformance/index.html
I'm looking for the first row, the L2030 latest price.
My R code returns a lexical error: invalid char in json text
Here's my R code:
require(rvest)
require(V8)
require(dplyr)
require(readxl)
require(openxlsx)
require(jsonlite)
require(BatchGetSymbols)
require(magrittr)
require(lubridate)
url<-'https://www.tsp.gov/InvestmentFunds/FundPerformance/index.html'
page<-read_html(url)
tsptable1 <- page %>%
rvest::html_nodes('body') %>% html_nodes('td.col3') %>% html_text()
TSPquote<-fromJSON(tsptable1)
Any ideas on solving this, and resources to learn more about javascript enabled webpage scraping?