在 r 中抓取 (iframe) 搜索结果的网页抓取



我想从下面的网站上抓取所有NPI和详细信息。 "https://www.pverify.com/npi-lookup-find-npi-number-of-doctors-physicians/"

法典:

library("rvest")
library("xml2")
url="https://www.pverify.com/npi-lookup-find-npi-number-of-doctors-physicians/"
webpage<-read_html(url)
data_html <- html_nodes(webpage,'iframe')
data_html <-html_table(data_html)

当我尝试上面的代码时,错误消息是"错误:html_name(x) == "表"不是真的"请帮助我获取NPI号码及其详细信息。

你可以试试硒。

代码看起来或多或少像这样。

library(Rselenium)
library(XML)    
remDr <- remoteDriver(port = 4445L)
remDr$open()
remDr$navigate("https://www.pverify.com/npi-lookup-find-npi-number-of-doctors-physicians/")
h <- htmlParse(remDr$getPageSource()[[1]], encoding = "UTF-8")
h_table <- html_table(h)

要创建 docker 服务器,您可以在此处看到

最新更新