I'm trying to build a Shiny app to track vaccine progress, since the CDC page doesn't retain historical information. Looking at the page code with Chrome DevTools, I can see that I want to pull information from every <div> tag with class "card-content", which I tried doing with the following code, using the rvest package:
data <- read_html('https://covid.cdc.gov/covid-data-tracker/#vaccinations')
current_numbers <- data %>% html_nodes('div.card-content')
This returns an empty object with structure "List of 0."
I also used readr::read_file to generate a .txt file to see if something weird was happening. It returned a file with
<main id="maincontent">
</main>
and no intervening content, though the header and footer code seems all there.
Is there a better way to pull the data from the <main> content on the page? Is rvest the right package for this? I alternatively could try bs4 in Python, but don't know how to make a Shiny app from that.