[R] Web-scraping newbie - dynamic table into R?

Julio Farach j|@r@ch @end|ng |rom gm@||@com
Sat Apr 18 22:50:02 CEST 2020


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:

>        install.packages("rvest")

>   library(rvest)

>        Kenopage <- "
https://www.galottery.com/en-us/games/draw-games/keno.html#tab-winningNumbers
"

> Keno <- Read.hmtl(Kenopage)

>From there, I've been unable to progress, despite hours spend on
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?

-- 

Julio Farach
https://www.linkedin.com/in/farach
cell phone:  804/363-2161
email:  JFarach using gmail.com

	[[alternative HTML version deleted]]



More information about the R-help mailing list