I try to scrap tables from link: https://archive.twitter-trending.com/united-states/16-11-2023. My goal is to get all tables from this link. I use following code:
library(rvest)
library(dplyr)
link <- 'https://archive.twitter-trending.com/united-states/16-11-2023'
tt = read_html(link)
my_tables <- html_nodes(tt, "table")
for (table in my_tables) {
print(table %>% html_table())
}
And the output I got is:
# A tibble: 1 x 4
X1 X2 X3 X4
<lgl> <lgl> <chr> <chr>
1 NA NA United States Twitter Trends (16/11/2023) United States Twitter Trends (16/11/2023)
Why can`t I access tables?
It's a dynamic javascript-driven site, those tables are built by your browser. If you are fine with using Chrome,
chromoteand up to datervest(>= 1.0.4), you could tryread_html_live():Result:
Created on 2024-03-09 with reprex v2.1.0