# simple spider tool
在实际工作中,沉淀的一些简易、好用的爬虫工具,减少重复代码与文件冗余,希望一样能为使用者带来益处。如果您也想贡献好的代码片段,请将代码以及描述,通过邮箱( [xingcys@gmail.com](mailto:xingc<xingcys@gmail.com>) )发送给我。代码格式是遵循自我主观,如存在不足敬请指出!
## 安装
```shell
pip install simple-spider-tool
```
## 简单使用
```python
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`版本,请通过安装兼容扩展包以达到兼容使用
```shell
pip install simple-spider-tool[seventeen]
```
## 链接
Github:https://github.com/xingcweb/simple-spider-tool
在线文档:https://simple-spider-tool.xingc.top/
Raw data
{
"_id": null,
"home_page": "",
"name": "simple-spider-tool",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "datetime,jsonpath,md5,spider,timestamp,tool",
"author": "",
"author_email": "xingc <xingcys@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9f/7d/81e82e64e809d9bed247b110f711a8f56ad97feaf757bde4af82f24fd0bc/simple_spider_tool-0.0.19.tar.gz",
"platform": null,
"description": "# simple spider tool\n\n\u5728\u5b9e\u9645\u5de5\u4f5c\u4e2d\uff0c\u6c89\u6dc0\u7684\u4e00\u4e9b\u7b80\u6613\u3001\u597d\u7528\u7684\u722c\u866b\u5de5\u5177\uff0c\u51cf\u5c11\u91cd\u590d\u4ee3\u7801\u4e0e\u6587\u4ef6\u5197\u4f59\uff0c\u5e0c\u671b\u4e00\u6837\u80fd\u4e3a\u4f7f\u7528\u8005\u5e26\u6765\u76ca\u5904\u3002\u5982\u679c\u60a8\u4e5f\u60f3\u8d21\u732e\u597d\u7684\u4ee3\u7801\u7247\u6bb5\uff0c\u8bf7\u5c06\u4ee3\u7801\u4ee5\u53ca\u63cf\u8ff0\uff0c\u901a\u8fc7\u90ae\u7bb1\uff08 [xingcys@gmail.com](mailto:xingc<xingcys@gmail.com>) \uff09\u53d1\u9001\u7ed9\u6211\u3002\u4ee3\u7801\u683c\u5f0f\u662f\u9075\u5faa\u81ea\u6211\u4e3b\u89c2\uff0c\u5982\u5b58\u5728\u4e0d\u8db3\u656c\u8bf7\u6307\u51fa\uff01\n\n## \u5b89\u88c5\n\n```shell\npip install simple-spider-tool\n```\n## \u7b80\u5355\u4f7f\u7528\n\n```python\nfrom simple_spider_tool import format_json, jsonpath\n\ndata = {\n \"code\": 200,\n \"data\": [\n {\n \"id\": 1,\n \"username\": \"admin\",\n \"level\": \"boss\"\n },\n {\n \"id\": 2,\n \"username\": \"user\",\n \"level\": \"staff\"\n }\n ]\n}\n\nboss_name = jsonpath(data, '$.data[?(@.level==\"boss\")].username', first=True)\nall_user_info = jsonpath(data, '$.data[*].username')\n\nprint(boss_name)\nprint(format_json(all_user_info))\n```\n## \u517c\u5bb9\u4f7f\u7528\n\u5728`0.0.18`\u5bf9\u5305\u76ee\u5f55\u53d1\u751f\u6539\u53d8\uff0c\u7531`simple_spider_tools`\u66f4\u6539\u4e3a`simple_spider_tool`\uff0c\u5982\u6709\u4f7f\u7528\u8fc7\u4f4e\u4e8e`0.0.18`\u7248\u672c\uff0c\u8bf7\u901a\u8fc7\u5b89\u88c5\u517c\u5bb9\u6269\u5c55\u5305\u4ee5\u8fbe\u5230\u517c\u5bb9\u4f7f\u7528\n```shell\npip install simple-spider-tool[seventeen]\n```\n\n## \u94fe\u63a5\nGithub\uff1ahttps://github.com/xingcweb/simple-spider-tool\n\n\u5728\u7ebf\u6587\u6863\uff1ahttps://simple-spider-tool.xingc.top/",
"bugtrack_url": null,
"license": "",
"summary": "\u4e00\u4e9b\u7b80\u6613\u3001\u597d\u7528\u7684\u722c\u866b\u5de5\u5177\uff0c\u51cf\u5c11\u4ee3\u7801\u4e0e\u6587\u4ef6\u5197\u4f59\uff0c\u63d0\u5347\u5de5\u4f5c\u7684\u6548\u7387\u548c\u4ee3\u7801\u6574\u6d01\u5ea6",
"version": "0.0.19",
"split_keywords": [
"datetime",
"jsonpath",
"md5",
"spider",
"timestamp",
"tool"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9ca904c331fa5b70a8b6b1c5453b0ff6c92a85f8749a9ab5e81d67c6c229b98e",
"md5": "3c81dc6243c53ded8c8bab541e3dfe59",
"sha256": "a1e0dd25ea26c9656a46bcb60b34fe6f71dc6484763b0d745f30ca1ffd1c5f66"
},
"downloads": -1,
"filename": "simple_spider_tool-0.0.19-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c81dc6243c53ded8c8bab541e3dfe59",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 6456,
"upload_time": "2023-04-25T17:21:27",
"upload_time_iso_8601": "2023-04-25T17:21:27.726134Z",
"url": "https://files.pythonhosted.org/packages/9c/a9/04c331fa5b70a8b6b1c5453b0ff6c92a85f8749a9ab5e81d67c6c229b98e/simple_spider_tool-0.0.19-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f7d81e82e64e809d9bed247b110f711a8f56ad97feaf757bde4af82f24fd0bc",
"md5": "39ed7940bb3c5e45326f3ad9336bff6d",
"sha256": "ce11ff6cf137a3f1e8b5f76f64956fded2db1f9217facf5acec69d740d637d59"
},
"downloads": -1,
"filename": "simple_spider_tool-0.0.19.tar.gz",
"has_sig": false,
"md5_digest": "39ed7940bb3c5e45326f3ad9336bff6d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 4309,
"upload_time": "2023-04-25T17:21:29",
"upload_time_iso_8601": "2023-04-25T17:21:29.504363Z",
"url": "https://files.pythonhosted.org/packages/9f/7d/81e82e64e809d9bed247b110f711a8f56ad97feaf757bde4af82f24fd0bc/simple_spider_tool-0.0.19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-25 17:21:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "simple-spider-tool"
}