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
File details
Details for the file easy-spider-tool-document-1.0.13.tar.gz
.
File metadata
- Download URL: easy-spider-tool-document-1.0.13.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 882295b48f25639bf3c36919f3ad860164c259dd718187df50c8257c268eb28b |
|
MD5 | 80fd5870f941c76bf75b564a72c52d10 |
|
BLAKE2b-256 | ccc4a5c79e72293655f3c83e5e6921a1699a3f3ebc37a78ce7e559b0160f39d7 |
File details
Details for the file easy_spider_tool_document-1.0.13-py3-none-any.whl
.
File metadata
- Download URL: easy_spider_tool_document-1.0.13-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7f1dabd1d1524cac3a0e98b6a6a16406a3bf34fb410decf9137b1ec9080e051 |
|
MD5 | fdb32d2f4568ad90d7f4ea621a08778a |
|
BLAKE2b-256 | 03e65c3d7aefc0e43a5dbbd12231938a67522e16cbdc43b6b96828a3d853999d |