Skip to main content

轻松访问 Google Scholar 的作者和引文

项目描述

Python 包 编解码器 文件状态 DOI

学术的

Academicly 是一个模块,它允许您以友好的 Pythonic 方式从Google Scholar检索作者和出版物信息,而无需解决验证码。

安装

Anaconda 服务器徽章 PyPI 版本

scholarly可以使用conda或使用pip. 要安装 using conda,只需运行

conda install -c conda-forge scholarly

或者,使用pippypi 安装最新版本:

pip3 install scholarly

pip从 github 安装:

pip3 install -U git+https://github.com/scholarly-python-package/scholarly.git

我们不断开发新功能。请定期更新您的本地软件包。 scholarly遵循语义版本控制。这意味着使用较早版本的代码scholarly保证可以与较新版本一起使用。

可选依赖项

  • 托尔

    scholarly附带一些 API 来设置代理以规避反机器人措施。Tor 方法自 v1.5 起已被弃用,并且未进行积极测试或支持。如果您想使用 Tor,请scholarly使用tor标签安装

    pip3 install scholarly[tor]
    

    如果您使用zsh(现在是最新 macOS 中的默认设置),您应该将其键入为

    pip3 install scholarly'[tor]'
    

    注意: Tor 选项不适用于 conda 安装。

测试

要检查您的安装是否成功,请通过执行以下test_module.py文件来运行测试:

python3 test_module

或者

python3 -m unittest -v test_module.py

文档

查看文档以获取完整的 API 参考快速入门指南

例子

from scholarly import scholarly

# Retrieve the author's data, fill-in, and print
# Get an iterator for the author results
search_query = scholarly.search_author('Steven A Cholewiak')
# Retrieve the first result from the iterator
first_author_result = next(search_query)
scholarly.pprint(first_author_result)

# Retrieve all the details for the author
author = scholarly.fill(first_author_result )
scholarly.pprint(author)

# Take a closer look at the first publication
first_publication = author['publications'][0]
first_publication_filled = scholarly.fill(first_publication)
scholarly.pprint(first_publication_filled)

# Print the titles of the author's publications
publication_titles = [pub['bib']['title'] for pub in author['publications']]
print(publication_titles)

# Which papers cited that publication?
citations = [citation['bib']['title'] for citation in scholarly.citedby(first_publication_filled)]
print(citations)

重要提示:进行某些类型的查询,例如scholarly.citedbyscholarly.search_pubs,将导致 Google Scholar 阻止您的请求,并可能最终阻止您的 IP 地址。您必须使用代理服务来避免这种情况。有关详细信息,请参阅文档中的“使用代理”部分。这是一个简短的示例:

from scholarly import ProxyGenerator

# Set up a ProxyGenerator object to use free proxies
# This needs to be done only once per session
pg = ProxyGenerator()
pg.FreeProxies()
scholarly.use_proxy(pg)

# Now search Google Scholar from behind a proxy
search_query = scholarly.search_pubs('Perception of physical stability and center of mass of 3D objects')
scholarly.pprint(next(search_query))

scholarly还具有可与多种高级(付费)代理服务一起使用的 API。 scholarly足够聪明,可以知道哪些查询需要代理,哪些不需要。因此,建议始终在应用程序开始时设置代理。

免责声明

开发人员用于ScraperAPI在 Github Actions 中运行测试。的开发人员scholarly不隶属于任何代理服务,也不从中获利。如果您最喜欢的服务不受支持,请提交一个问题,或者更好的是,通过拉取请求跟进它。

贡献

我们欢迎您的贡献。请创建一个问题,分叉此存储库并提交拉取请求。阅读贡献文档以获取更多信息。

承认scholarly

如果您在科学出版物中使用过此代码库,请按以下方式引用此软件:

@software{cholewiak2021scholarly,
  author  = {Cholewiak, Steven A. and Ipeirotis, Panos and Silva, Victor and Kannawadi, Arun},
  title   = {{SCHOLARLY: Simple access to Google Scholar authors and citation using Python}},
  year    = {2021},
  doi     = {10.5281/zenodo.5764801},
  license = {Unlicense},
  url = {https://github.com/scholarly-python-package/scholarly},
  version = {1.5.1}
}

执照

这个项目的原始代码是由Luciano BelloWTFPL许可下发布的。本着这种心态,所有代码都在Unlicense下发布。

项目详情