【问题标题】:How to scrape genecards summaries with R如何使用 R 抓取基因卡摘要
【发布时间】:2021-06-15 13:55:52
【问题描述】:

我想抓取genecards.com。 robotstxt 包中的函数paths_allowed() 表示允许抓取有关给定基因的信息。我的例子是:https://www.genecards.org/cgi-bin/carddisp.pl?gene=TOP1 我想提取摘要部分,即从:“TOP1 基因的Entrez 基因摘要”到“TOP1 基因的基因维基条目”。一次是整个部分,或者是一个接一个的摘要。 我用类标签“.list-unstyled”一个接一个地尝试了它 到目前为止我的过程:

genes <- c("TOP1")

paths_allowed(paths = "https://www.genecards.org/cgi-bin/carddisp.pl?gene=TOP1")
base <- xml2::read_html(paste0(base_genecards, genes[1]))
base %>% html_nodes(".list-unstyled") # refer to the in the hierarchy lowest class

这给出了结果

{xml_nodeset (0)}

我知道我必须在之后使用html_text(),但我没有做到这一点,因为我没有在此页面上获得任何查询。我在 imdb 上试了一下,效果很好。 我很难将摘要文本输入 R。我的错误在哪里? 谢谢

【问题讨论】:

  • 仅供参考,它是 scrapescrapingscrapedscraper 不是报废、报废,报废或报废。 “废弃”意味着像垃圾一样扔掉:-(

标签: html r web-scraping


【解决方案1】:

致所有发现这一点的人:似乎基因卡受封装保护,这是为了保护该网站不被刮掉。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    • 2021-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多