easy spider tool
在实际工作中,沉淀的一些简易、好用的爬虫工具,减少重复代码与文件冗余,希望一样能为使用者带来益处。如果您也想贡献好的代码片段,请将代码以及描述,通过邮箱( xinkonghan@gmail.com )发送给我。代码格式是遵循自我主观,如存在不足敬请指出!
安装
pip install easy_spider_tool
主要功能
时间相关before_day昨天日期(可用于时间递减)after_day明天日期(可用于时间递增)between_day两个日期之间current_date当前时间timestamp当前时间戳(支持精确到毫秒)date_parse任意格式时间解析(支持时区转换,指定保留日期/时间(可设置默认值)部分)
json相关format_json漂亮美观的格式化输出jsonpath任意多个json路径解析(支持设置默认值,选取首个匹配值)
hash摘要相关md5字符经md5编码
正则匹配相关regex_match条件匹配(支持多个不相关条件匹配,支持设置默认值,选取首个匹配值)for_to_regx_match多个不相关条件匹配(兼容老版本保留)
数据清洗/转换相关cookie_to_diccookie转换为字典(Dict)格式clear_value清除列表(List)或字典(Dict)中的指定值(递归清除所有嵌套字典和列表中的指定值)
合法性验证相关verify_ip_addressIP地址合法性验证verify_domain_name域名合法性验证verify_port端口合法性验证verify_urlURL合法性验证
通知相关- 暂无
简单使用
from easy_spider_tool import format_json, jsonpath
data = {
"code": 200,
"data": [
{
"id": 1,
"username": "admin",
"level": "boss"
},
{
"id": 2,
"username": "user",
"level": "staff"
}
]
}
boss_name = jsonpath(data, '$.data[?(@.level=="boss")].username', first=True)
all_user_info = jsonpath(data, '$.data[*].username')
print(boss_name)
print(format_json(all_user_info))
链接
Github:https://github.com/hanxinkong/easy-spider-tool
在线文档:https://easy-spider-tool.xink.top/
注明
该工具借鉴作者【xingcweb】,根据主观新增部分功能
Metadata
Release files for easy-spider-tool 1.0.17
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 |
|---|---|---|---|---|
| easy_spider_tool-1.0.17.tar.gz | 12.0 kB | Without provenance | Details for easy_spider_tool-1.0.17.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easy_spider_tool-1.0.17-py3-none-any.whl | Python 3 | none | any | Details for easy_spider_tool-1.0.17-py3-none-any.whl |
Total release size: 25.6 kB
Release files / easy_spider_tool-1.0.17.tar.gz
| Download URL | easy_spider_tool-1.0.17.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f3a87298798de988ea43b5a11521fb72e0aebcee47b27c0fe010aecc7542124
|
|
BLAKE2b-256 checksum How to use checksums |
429384082ed8048078dde280543d2ce2915acbb6aa81a20a4f5e420232997d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.6
|
Release files / easy_spider_tool-1.0.17-py3-none-any.whl
| Download URL | easy_spider_tool-1.0.17-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c485616689400fa6d0f6d5832c9884e90349406dc09a04d64e77acecae5ec7a
|
|
BLAKE2b-256 checksum How to use checksums |
68aabdbd9d768d8ec4179ba3f6316239f02fc927325e51f2eb426317bffa77af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.6
|
Security for easy-spider-tool 1.0.17
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.