我对网络抓取很陌生,我一直在努力搜集英国地方政府的右侧名单和新冠肺炎案件的数量。
以下是网站:https://www.arcgis.com/apps/opsdashboard/index.html#/f94c3c90da5b4e9f9a0b19484dd4bb14
我已经能够刮维基百科,但我不知道从哪里开始从上面的网站。任何提示/链接都将是非常有用和非常感谢的!
发布于 2022-10-10 00:16:54
通过以下代码,我在页面中获得了一些数字:
library(rvest)
library(RSelenium)
port <- as.integer(4444L + rpois(lambda = 1000, 1))
rd <- rsDriver(chromever = "105.0.5195.52", browser = "chrome", port = port)
remDr <- rd$client
remDr$open()
url <- "https://coronavirus.data.gov.uk/"
remDr$navigate(url)
html_Content <- remDr$getPageSource()[[1]]
text <- read_html(html_Content) %>% html_text2()
text <- strsplit(text, "\n")[[1]]
text[54 : 72]
[1] "Last 7 days – first dose"
[2] "10,536Number of people vaccinated (first dose) in the 7 days to 2 October 2022"
[3] "Total – first dose"
[4] "45,275,970Total number of people vaccinated (first dose) reported on 2 October 2022"
[5] "Last 7 days – second dose"
[6] "18,800Number of people vaccinated (second dose) in the 7 days to 2 October 2022"
[7] "Total – second dose"
[8] "42,718,917Total number of people vaccinated (second dose) reported on 2 October 2022"
[9] "Last 7 days – booster or third dose"
[10] "25,518Number of people vaccinated (booster or third dose) in the 7 days to 2 October 2022"
[11] "Total – booster or third dose"
[12] "33,613,297Total number of people vaccinated (booster or third dose) reported on 2 October 2022"
[13] "Percentage of population aged 12+"
[14] "93.6%Percentage of population aged 12+ vaccinated (first dose) reported on 2 October 2022"
[15] "First dose"
[16] "88.3%Percentage of population aged 12+ vaccinated (second dose) reported on 2 October 2022"
[17] "Second dose"
[18] "69.5%Percentage of population aged 12+ vaccinated (booster or third dose) reported on 2 October 2022"
[19] "Booster or third dose" 我希望这是有帮助的!
https://stackoverflow.com/questions/60930990
复制相似问题