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.12.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for easy-spider-tool-document-1.0.12.tar.gz
Algorithm Hash digest
SHA256 7da75aec21a16e501cac9035a04b1b40e1760229a7b416dacca94d72e9bb3caa
MD5 d16287a21b139b4aefdecd2cc81e8cef
BLAKE2b-256 96be1f1663a1d41dc4a785f1067bed78549b123ba1a7d5c09da3cdd1297e3e6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easy_spider_tool_document-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 a13fee5464136519b86885e06dbdc7d021c26f3f21a7b18febb90e97e960a860
MD5 395c9eb9570116750fb8b14a4539b84c
BLAKE2b-256 2bc8943c7d3f1cb4c291bac2e9a690ca7a9d5049e5e0b93650e2e19a706be362

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