easy-spider-tool 可选xpath/jsonpath聚合解析扩展包
Project description
simple-spider-tool-document
easy-spider-tool 可选xpath/jsonpath聚合解析扩展包
安装
pip install easy-spider-tool[document]
主要功能
data_extractor
表达式数据解析(支持jsonpath,xpath)xpath
xpath语法解析数据(支持首选项,设置默认值)
简单使用
from easy_spider_tool_document import data_extractor
data = '<p>这是一个easy_spider_tool的document扩展的示例</p>'
print(data_extractor(data, ['//p//text()'], first=True, default=''))
# 这是一个easy_spider_tool的document扩展的示例
data = {
"code": 200,
"data": [
{
"id": 1,
"username": "admin",
"level": "boss"
},
{
"id": 2,
"username": "user",
"level": "staff"
}
]
}
print(data_extractor(data, ['$.data[*].username'], first=False, default=''))
# ['admin', 'user']
链接
Github:https://github.com/hanxinkong/easy-spider-tool-document
在线文档:https://easy-spider-tool-document.xink.top/
注明
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for easy-spider-tool-document-1.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 007df9a9af1259903c2adf2ea3247d4f350e236e150f5e046eb8c6273fd3ec6d |
|
MD5 | df0a6b4d2a5ff6e1f33aa1f80238aed5 |
|
BLAKE2b-256 | 39e1ce858e110779aa695ebc8b2f5d15a4b335b26fa0f997e64eac67f7099145 |
Close
Hashes for easy_spider_tool_document-1.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff57cabbad2ec33df0f0f4ea531d8f698ad487537eeaf68d32d356e74e9862ac |
|
MD5 | b2d1afae8bd7f67b7eefe80ee758f7eb |
|
BLAKE2b-256 | b201da946ce9cfbfff11251556cf7e5270f87dfb869f23ad5ca28f6316691669 |