1
我试图刮几1801 census pages与splashr
,可能有0到多个加载更多按钮(因为一次加载50个记录)。此页面应该有174刮飞溅的网页和加载更多按钮
url <- "https://digitalarkivet.no/en/census/district/tf01058443000001"
doc <- splash("localhost") %>% render_html(url, wait =3)
html_nodes(doc2, xpath="//h4[not(@class)]/a") %>% length()
[1] 50
我试图载入网址下面更多,但只是再次获得的第50个记录。
url2 <- html_nodes(doc, xpath="//div[@class='load-more']") %>% html_attr("data-url")
[1] "https://digitalarkivet.no/en/census/related/rural-residences/tf01058443000001?page=2"
请注意,大多数地区有少于50个记录,所以我不需要为每个页面点击加载更多。
这很好,谢谢。 –