I want to scrape a webpage that is javascript rendered so rvest alone doesn't do the work I want. I am familiar with RSelenium but I don't want to use it for this task since I want to scrape multiple pages and it takes time. I am not familiar with V8 but I used this page as a guide to come up with this code.
library(rvest)
library(V8)
ctx <- v8()
link <- "https://www.pff.com/nfl/players/Drew-Bledsoe/36"
link %>%
read_html() %>%
html_nodes('script') %>%
html_text() %>%
gsub('document.write','',.) %>%
ctx$eval() %>%
read_html() %>%
html_text()
However this gives me an error:
Error in context_eval(join(src), private$context, serialize) :
c++ exception (unknown reason)
What I want to do is get the year value under draft year for some players. An example here would be 1993 in this page.
Copyright Notice:Content Author:「memokerobi」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/66589525/getting-c-exception-trying-to-scrape-javascript-rendered-web-page-with-rvest-a