Skip to main content

一些简易、好用的爬虫工具,减少代码与文件冗余,提升工作的效率和代码整洁度

Project description

simple spider tool

在实际工作中,沉淀的一些简易、好用的爬虫工具,减少重复代码与文件冗余,希望一样能为使用者带来益处。如果您也想贡献好的代码片段,请将代码以及描述,通过邮箱( xingcys@gmail.com )发送给我。代码格式是遵循自我主观,如存在不足敬请指出!

安装

pip install simple-spider-tool

简单使用

from simple_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))

兼容使用

0.0.18对包目录发生改变,由simple_spider_tools更改为simple_spider_tool,如有使用过低于0.0.18版本,请通过安装兼容扩展包以达到兼容使用

pip install simple-spider-tool[seventeen]

链接

Github:https://github.com/xingcweb/simple-spider-tool

在线文档:https://simple-spider-tool.xingc.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

simple_spider_tool-0.0.19.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

simple_spider_tool-0.0.19-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

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