baikeS
baidu-baike-spider
百度百科简易爬虫
⚠️ 该爬虫仅用于学习使用, 不得用于任何非法用途或侵犯他人合法权益 ⚠️
安装
pip install baikes
使用
模块
获取你想要的数据
from baikes import Baike
baike = Baike("网络爬虫")
print(baike.album)
print(baike.intro)
print(baike.paragraphs)
# ...
Baike 对象包含以下属性:
| 属性名 | 类型 | 描述 |
|---|---|---|
| name | str |
条目名称 |
| title | str |
条目标题 |
| album | str |
概述图 URL |
| intro | str |
简介 |
| card | OrderedDict |
知识卡片 |
| paragraphs | OrderedDict |
描述段落 |
有时可能会出现同名词, 参数 category 用于限定词条分类:
from baikes import Baike
baike = Baike("黄蜂", category="动物")
命令行
该爬虫可使用命令行进行调用
示例:
# 获取全部
python -m baikes -n "网络爬虫"
# 限定词条分类
python -m baikes -n "黄蜂" -c "动物"
# 获取百科卡片
python -m baikes -n "网络爬虫" card
Metadata
Release files for baikes 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| baikes-0.1.5.tar.gz | 6.2 kB | Without provenance | Details for baikes-0.1.5.tar.gz |
Release files / baikes-0.1.5.tar.gz
| Download URL | baikes-0.1.5.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8cb749c35f76f57df8420e9f0639b8c6153216e667e10d68d2fed6c884e0c41
|
|
BLAKE2b-256 checksum How to use checksums |
3e5436c253d047ad927a6102a5f22e84d0e4f95af66161047820b22f810b4431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.10
|
Security for baikes 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.