Skip to content

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

License

Notifications You must be signed in to change notification settings

xingcweb/simple-spider-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages