scholarly项目技术文档

scholarly项目技术文档

scholarly Retrieve author and publication information from Google Scholar in a friendly, Pythonic way without having to worry about CAPTCHAs! scholarly 项目地址: https://gitcode.com/gh_mirrors/sc/scholarly

scholarly是一个Python模块,它使得从Google Scholar获取作者和出版物信息变得简单直观,无需解决验证码问题。

安装指南

您可以通过以下两种方法之一来安装scholarly

  • 使用Conda

    执行以下命令以通过conda-forge通道安装:

    conda install -c conda-forge scholarly
    
  • 使用pip

    获取最新版本,可以运行:

    pip3 install scholarly
    

    或者直接从GitHub仓库安装最新代码:

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

    对于包含Tor支持的可选安装,您可以这样做(不适用于Conda):

    pip3 install scholarly[tor]
    

请注意,频繁更新是推荐的,因为scholarly遵循语义化版本控制(Semantic Versioning),确保您的代码兼容性。

项目的使用说明

快速开始

在成功安装scholarly后,您就可以开始查询作者信息了。下面的例子展示如何检索并打印一个作者的详细资料及其发表作品的标题。

from scholarly import scholarly

# 搜索作者
search_query = scholarly.search_author('Steven A Cholewiak')
first_author_result = next(search_query)
scholarly.pprint(first_author_result)

# 填充作者详细信息并打印
author = scholarly.fill(first_author_result)
scholarly.pprint(author)

# 打印作者的作品标题
publication_titles = [pub['bib']['title'] for pub in author['publications']]
print(publication_titles)

使用API

scholarly提供了丰富的API来操作数据。例如,填充更多作者详情和查看引用情况:

# 查看首个作品的引用文献
first_publication_filled = scholarly.fill(author['publications'][0])
citations = [citation['bib']['title'] for citation in scholarly.citedby(first_publication_filled)]
print(citations)

API使用文档

完整API参考请查阅官方文档的scholarly.html页面

重要提示

频繁执行某些类型查询时,如scholarly.citedbyscholarly.search_pubs,可能会被Google Scholar限制访问。为了避免IP被封,应当使用代理服务。详情见文档中的"使用代理"部分

测试

验证安装是否成功的简单方式是运行测试脚本:

python3 test_module.py

或者使用unittest模块:

python3 -m unittest -v test_module.py

以上就是对scholarly项目的简要技术文档。详细功能和高级用法请深入阅读其官方文档。记住,在使用过程中设置代理以保障稳定性和避免潜在的访问限制是关键。

scholarly Retrieve author and publication information from Google Scholar in a friendly, Pythonic way without having to worry about CAPTCHAs! scholarly 项目地址: https://gitcode.com/gh_mirrors/sc/scholarly

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卫直超Unity

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值