【问题标题】:Extract links from specific div - Rvest从特定 div 中提取链接 - Rvest
【发布时间】:2022-01-28 03:36:04
【问题描述】:

我正在尝试从网站的特定类中提取链接。但是,当我这样做时,会有一个空数据集。

library(rvest)
library(purrr)
library(dplyr)

links_avai <- paste0("https://avai.com.br/page", seq(from = 1, to = 2)) %>%
  map(. %>%
        read_html() %>%
        html_nodes(xpath = '//*[@class="gdlr-blog-title"]') %>%
        html_attr("href"))

【问题讨论】:

    标签: web-scraping rvest


    【解决方案1】:
    links_avai <- paste0("https://avai.com.br/page", seq(from = 1, to = 2)) %>%
      map(. %>%
            read_html() %>%
            html_nodes(xpath = '//*[@class="gdlr-blog-title"]') %>%
            html_nodes("a") %>%
            html_attr("href"))
    

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2016-05-16
    • 2021-06-09
    • 2017-10-11
    • 2021-11-20
    • 2018-11-03
    • 2017-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多