Skip to content
Prev 383336 / 398502 Next

Web-scraping newbie - dynamic table into R?

How do I scrape the last 10 Keno draws from the Georgia lottery into R?


I'm trying to pull the last 10 draws of a Keno lottery game into R.  I've
read several tutorials on how to scrape websites using the rvest package,
Chrome's Inspect Element, and CSS or XPath, but I'm likely stuck because
the table I seek is dynamically generated using Javascript.



I started with:
https://www.galottery.com/en-us/games/draw-games/keno.html#tab-winningNumbers
"
combinations of CSS and XPath calls with "html_notes."

Failed example: DrawNumber <- Keno %>% rvest::html_nodes("body") %>%
xml2::xml_find_all("//span[contains(@class,'Draw Number')]") %>%
rvest::html_text()



Someone mentioned using the V8 package in R, but it's new to me.

How do I get started?