Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过“提取数据”;html“U节点”;有两个条件_Html_R_Nodes - Fatal编程技术网

通过“提取数据”;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">