【问题标题】:Exporting citation of a journal article using R使用 R 导出期刊文章的引用
【发布时间】:2015-01-10 03:48:33
【问题描述】:

我希望 R:

  1. 转到THIS 页面。
  2. 选择“Bibtex”作为格式,选择“引文和摘要”作为“导出类型”。
  3. 按“提交”,将引文文件下载到指定文件夹。

有可能吗?我怎么能用 R 做到这一点? (我不懂 JavaScript,也无法理解与此问题密切相关的早期主题。123

最终,我想下载期刊(例如 THIS 期刊)的所有 bibtex(可能还有尾注)引用。

【问题讨论】:

    标签: javascript r web-scraping scrape


    【解决方案1】:

    我认为rcrossrefhttps://github.com/ropensci/rcrossref#citation-search可以在这里帮助你,例如,

    install.packages("rcrossref")
    library("rcrossref")    
    
    cat(cr_cn(dois = "10.1126/science.169.3946.635", format = "bibtex"))
    #> @article{Frank_1970,
    #>  doi = {10.1126/science.169.3946.635},
    #>  url = {http://dx.doi.org/10.1126/science.169.3946.635},
    #>  year = 1970,
    #>  month = {aug},
    #>  publisher = {American Association for the Advancement of Science ({AAAS})},
    #>  volume = {169},
    #>  number = {3946},
    #>  pages = {635--641},
    #>  author = {H. S. Frank},
    #>  title = {The Structure of Ordinary Water: New data and interpretations are yielding new insights     into this fascinating substance},
    #>  journal = {Science}
    #> }
    

    有了这个,您只需要 DOI。包中还有其他功能,可以搜索文章,获取出版商的DOI等。

    希望对你有帮助

    【讨论】:

    • 我是rcrossref 的维护者 - 如果您有任何问题,请告诉我
    • 感谢您指出这一点。我不知道它的存在。我猜这不会得到给定 DOI 的文章的摘要,对吧?
    【解决方案2】:

    您可以使用 httr 包伪造表单提交。对于这个请求,你可以做

    values <- list(
        doi = "10.1002%2Fasi.21577",
        fileFormat = "BIBTEX",
        hasAbstract = "CITATION_AND_ABSTRACT"
    )
    
    library(httr)
    url <- "http://onlinelibrary.wiley.com/documentcitationdownloadformsubmit"
    rr <- POST(url=url, body=values, encode="form")
    content(rr, "text")
    # [1] "@article {ASI:ASI21577,\nauthor = {Callahan, Ewa S. ...
    

    【讨论】:

    • 如果你不想让它成为一个流,你需要这样的东西:val &lt;-readLines(textConnection(content(rr, "text")))
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-21
    • 2012-04-05
    • 2017-02-22
    • 1970-01-01
    • 1970-01-01
    • 2017-02-16
    • 1970-01-01
    相关资源
    最近更新 更多