通过“提取数据”;html“U节点”;有两个条件
我正试图从一个特定的网站上提取一份价目表通过“提取数据”;html“U节点”;有两个条件,html,r,nodes,Html,R,Nodes,我正试图从一个特定的网站上提取一份价目表 price <- paste0("price", 1:24) dfprice <- as.data.frame(price) for (i in datalist){ PanInfos <- html_nodes(i, css = '.info') price您可以尝试指定上面的级别,例如:%%>%html\u节点('span.now.price')但是如果我只指定:%%>%html\u节点('span.now.price'),只
price <- paste0("price", 1:24)
dfprice <- as.data.frame(price)
for (i in datalist){
PanInfos <- html_nodes(i, css = '.info')
price您可以尝试指定上面的级别,例如:%%>%html\u节点('span.now.price')
但是如果我只指定:%%>%html\u节点('span.now.price'),只提取销售价格。。。正常价格的span class=“价格按钮”。我需要“价格按钮”或“现在”html_节点。
PRICE <-
PanInfos %>%
html_nodes('.price') %>%
html_text()
length(PRICE) <- nrow(dfprice)
PRICE <- as.data.frame(PRICE)
dfprice <- cbind(dfprice, PRICE
}
<span class = "price-button">
<span itemprop = "price" class = "price">
<span class ="now">
<span class = "price">
<span itemprop="price" class="price">
<span class = "reduction">
<span class = "price">
<span itemprop = "price" class="price">