Skip to main content

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

easy-spider-tool-document-1.0.13.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file easy-spider-tool-document-1.0.13.tar.gz.

File metadata

File hashes

Hashes for easy-spider-tool-document-1.0.13.tar.gz
Algorithm Hash digest
SHA256 882295b48f25639bf3c36919f3ad860164c259dd718187df50c8257c268eb28b
MD5 80fd5870f941c76bf75b564a72c52d10
BLAKE2b-256 ccc4a5c79e72293655f3c83e5e6921a1699a3f3ebc37a78ce7e559b0160f39d7

See more details on using hashes here.

File details

Details for the file easy_spider_tool_document-1.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_spider_tool_document-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 a7f1dabd1d1524cac3a0e98b6a6a16406a3bf34fb410decf9137b1ec9080e051
MD5 fdb32d2f4568ad90d7f4ea621a08778a
BLAKE2b-256 03e65c3d7aefc0e43a5dbbd12231938a67522e16cbdc43b6b96828a3d853999d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page