# 项目简介
![许可证 Badge](https://img.shields.io/github/license/fhu-yezi/JianshuResearchTools?color=%234263eb&label=%E8%AE%B8%E5%8F%AF%E8%AF%81)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/FHU-yezi/JianshuResearchTools.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FHU-yezi/JianshuResearchTools/context:python)
![代码库大小 Badge](https://img.shields.io/github/repo-size/fhu-yezi/JianshuResearchTools?color=%2352c41a&label=%E4%BB%A3%E7%A0%81%E5%BA%93%E5%A4%A7%E5%B0%8F)
![GitHub 最新版本 Badge](https://img.shields.io/github/v/release/fhu-yezi/JianshuResearchTools?color=%233339af0&label=GitHub%20%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC)
![PyPI 最新版本 Badge](https://img.shields.io/pypi/v/JianshuResearchTools?color=%233339af0&label=PyPI%20%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC)
![Github Release 总下载量 Badge](https://img.shields.io/github/downloads/fhu-yezi/JianshuResearchTools/total?color=%23c41d7f&label=GitHub%20%E6%80%BB%E4%B8%8B%E8%BD%BD%E9%87%8F)
![PyPI 月下载量 Badge](https://img.shields.io/pypi/dm/JianshuResearchTools?color=%23597ef7&label=PyPI%20%E6%9C%88%E4%B8%8B%E8%BD%BD%E9%87%8F)
![打开的 Issues 数量 Badge](https://img.shields.io/github/issues-raw/fhu-yezi/JianshuResearchTools?color=%23339af0&label=%E6%89%93%E5%BC%80%E7%9A%84%20Issues%20%E6%95%B0%E9%87%8F)
> 科技赋能创作星辰。
JRT 是一个简书数据获取与分析库,致力于用更简单的方式,帮助有编程基础的用户快速进行数据分析,助力社区成长。
该库基于简书官方接口。
# 安装
## 自动安装
JRT 已上传到 PyPI,可使用以下命令自动安装:
```
pip install JianshuResearchTools
```
## 手动安装
您亦可以手动下载项目源代码,使用 `setup.py` 将其安装到您的设备上。
同时,您还需要运行以下命令,下载 JRT 的依赖库:
```
pip install httpx lxml
```
您可运行以下代码示例,确认 JRT 已在您的设备上正常安装:
```python
import JianshuResearchTools as jrt
print(jrt.__version__)
```
如果一切正常,您会看到 JRT 的版本号。
# 快速上手
## 函数调用
示例一,获取用户昵称:
```python
>>> import JianshuResearchTools as jrt
>>> jrt.user.GetUserName("https://www.jianshu.com/u/ea36c8d8aa30")
'初心不变_叶子'
```
示例二,获取文章标题:
```python
>>> import JianshuResearchTools as jrt
>>> jrt.article.GetArticleTitle("https://www.jianshu.com/p/2c2b76a1d0ae")
'你好,简书贝'
```
## 面向对象
示例一,获取用户昵称:
```python
>>> import JianshuResearchTools as jrt
>>> user = jrt.objects.User("https://www.jianshu.com/u/ea36c8d8aa30")
>>> user.name
'初心不变_叶子'
```
示例二,获取用户信息摘要:
```python
>>> import JianshuResearchTools as jrt
>>> user = jrt.objects.User("https://www.jianshu.com/u/ea36c8d8aa30")
>>> print(user)
用户信息摘要:
昵称: 初心不变_叶子
URL: https://www.jianshu.com/u/ea36c8d8aa30
性别: 1
关注者数: 388
粉丝数: 1094
文章数: 159
总字数: 316169
简书钻: 15122.726
简书贝: 4877.274
总资产: 20000.0
徽章: 简书创作者 岛主 社区守护者
最后更新时间: 2022-02-02 08:29:26
会员等级: None
会员过期时间: None
个人简介:
```
# 依赖库
## 必须依赖
- httpx:用于实现网络请求
- lxml:用于实现基于 Xpath 的 HTML 解析
## 可选依赖
- ujson:安装后在大量数据获取场景将获得一定性能提升
- tomd:安装后可以使用 `jrt.article.GetArticleMarkdown()` 函数获取 Markdown 格式的文章内容
# 贡献
详见贡献指南文件。(CONTRIBUTING.md)
Raw data
{
"_id": null,
"home_page": "https://github.com/FHU-yezi/JianshuResearchTools",
"name": "jianshuresearchtools",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "jianshu,SDK",
"author": "yezi",
"author_email": "yehaowei20060411@qq.com",
"download_url": "https://files.pythonhosted.org/packages/9d/59/51737b50184c348c97eb7e9227a1f7ac2b0370d233b87cffdbcef4ede90d/jianshuresearchtools-2.11.0.tar.gz",
"platform": null,
"description": "# \u9879\u76ee\u7b80\u4ecb\n\n![\u8bb8\u53ef\u8bc1 Badge](https://img.shields.io/github/license/fhu-yezi/JianshuResearchTools?color=%234263eb&label=%E8%AE%B8%E5%8F%AF%E8%AF%81)\n\n[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/FHU-yezi/JianshuResearchTools.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FHU-yezi/JianshuResearchTools/context:python)\n\n![\u4ee3\u7801\u5e93\u5927\u5c0f Badge](https://img.shields.io/github/repo-size/fhu-yezi/JianshuResearchTools?color=%2352c41a&label=%E4%BB%A3%E7%A0%81%E5%BA%93%E5%A4%A7%E5%B0%8F)\n\n![GitHub \u6700\u65b0\u7248\u672c Badge](https://img.shields.io/github/v/release/fhu-yezi/JianshuResearchTools?color=%233339af0&label=GitHub%20%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC)\n\n![PyPI \u6700\u65b0\u7248\u672c Badge](https://img.shields.io/pypi/v/JianshuResearchTools?color=%233339af0&label=PyPI%20%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC)\n\n![Github Release \u603b\u4e0b\u8f7d\u91cf Badge](https://img.shields.io/github/downloads/fhu-yezi/JianshuResearchTools/total?color=%23c41d7f&label=GitHub%20%E6%80%BB%E4%B8%8B%E8%BD%BD%E9%87%8F)\n\n![PyPI \u6708\u4e0b\u8f7d\u91cf Badge](https://img.shields.io/pypi/dm/JianshuResearchTools?color=%23597ef7&label=PyPI%20%E6%9C%88%E4%B8%8B%E8%BD%BD%E9%87%8F)\n\n![\u6253\u5f00\u7684 Issues \u6570\u91cf Badge](https://img.shields.io/github/issues-raw/fhu-yezi/JianshuResearchTools?color=%23339af0&label=%E6%89%93%E5%BC%80%E7%9A%84%20Issues%20%E6%95%B0%E9%87%8F)\n\n> \u79d1\u6280\u8d4b\u80fd\u521b\u4f5c\u661f\u8fb0\u3002\n\nJRT \u662f\u4e00\u4e2a\u7b80\u4e66\u6570\u636e\u83b7\u53d6\u4e0e\u5206\u6790\u5e93\uff0c\u81f4\u529b\u4e8e\u7528\u66f4\u7b80\u5355\u7684\u65b9\u5f0f\uff0c\u5e2e\u52a9\u6709\u7f16\u7a0b\u57fa\u7840\u7684\u7528\u6237\u5feb\u901f\u8fdb\u884c\u6570\u636e\u5206\u6790\uff0c\u52a9\u529b\u793e\u533a\u6210\u957f\u3002\n\n\u8be5\u5e93\u57fa\u4e8e\u7b80\u4e66\u5b98\u65b9\u63a5\u53e3\u3002\n\n# \u5b89\u88c5\n\n## \u81ea\u52a8\u5b89\u88c5\n\nJRT \u5df2\u4e0a\u4f20\u5230 PyPI\uff0c\u53ef\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u81ea\u52a8\u5b89\u88c5\uff1a\n\n```\npip install JianshuResearchTools\n```\n\n## \u624b\u52a8\u5b89\u88c5\n\n\u60a8\u4ea6\u53ef\u4ee5\u624b\u52a8\u4e0b\u8f7d\u9879\u76ee\u6e90\u4ee3\u7801\uff0c\u4f7f\u7528 `setup.py` \u5c06\u5176\u5b89\u88c5\u5230\u60a8\u7684\u8bbe\u5907\u4e0a\u3002\n\n\u540c\u65f6\uff0c\u60a8\u8fd8\u9700\u8981\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4e0b\u8f7d JRT \u7684\u4f9d\u8d56\u5e93\uff1a\n\n```\npip install httpx lxml\n```\n\n\u60a8\u53ef\u8fd0\u884c\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\uff0c\u786e\u8ba4 JRT \u5df2\u5728\u60a8\u7684\u8bbe\u5907\u4e0a\u6b63\u5e38\u5b89\u88c5\uff1a\n\n```python\nimport JianshuResearchTools as jrt\nprint(jrt.__version__)\n```\n\n\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u4f1a\u770b\u5230 JRT \u7684\u7248\u672c\u53f7\u3002\n\n# \u5feb\u901f\u4e0a\u624b\n\n## \u51fd\u6570\u8c03\u7528\n\n\u793a\u4f8b\u4e00\uff0c\u83b7\u53d6\u7528\u6237\u6635\u79f0\uff1a\n\n```python\n>>> import JianshuResearchTools as jrt\n>>> jrt.user.GetUserName(\"https://www.jianshu.com/u/ea36c8d8aa30\")\n'\u521d\u5fc3\u4e0d\u53d8_\u53f6\u5b50'\n```\n\n\u793a\u4f8b\u4e8c\uff0c\u83b7\u53d6\u6587\u7ae0\u6807\u9898\uff1a\n\n```python\n>>> import JianshuResearchTools as jrt\n>>> jrt.article.GetArticleTitle(\"https://www.jianshu.com/p/2c2b76a1d0ae\")\n'\u4f60\u597d\uff0c\u7b80\u4e66\u8d1d'\n```\n\n## \u9762\u5411\u5bf9\u8c61\n\n\u793a\u4f8b\u4e00\uff0c\u83b7\u53d6\u7528\u6237\u6635\u79f0\uff1a\n\n```python\n>>> import JianshuResearchTools as jrt\n>>> user = jrt.objects.User(\"https://www.jianshu.com/u/ea36c8d8aa30\") \n>>> user.name\n'\u521d\u5fc3\u4e0d\u53d8_\u53f6\u5b50'\n```\n\n\u793a\u4f8b\u4e8c\uff0c\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u6458\u8981\uff1a\n```python\n>>> import JianshuResearchTools as jrt\n>>> user = jrt.objects.User(\"https://www.jianshu.com/u/ea36c8d8aa30\")\n>>> print(user)\n\u7528\u6237\u4fe1\u606f\u6458\u8981\uff1a\n\u6635\u79f0: \u521d\u5fc3\u4e0d\u53d8_\u53f6\u5b50\nURL: https://www.jianshu.com/u/ea36c8d8aa30\n\u6027\u522b: 1\n\u5173\u6ce8\u8005\u6570: 388\n\u7c89\u4e1d\u6570: 1094\n\u6587\u7ae0\u6570: 159\n\u603b\u5b57\u6570: 316169\n\u7b80\u4e66\u94bb: 15122.726\n\u7b80\u4e66\u8d1d: 4877.274\n\u603b\u8d44\u4ea7: 20000.0\n\u5fbd\u7ae0: \u7b80\u4e66\u521b\u4f5c\u8005 \u5c9b\u4e3b \u793e\u533a\u5b88\u62a4\u8005\n\u6700\u540e\u66f4\u65b0\u65f6\u95f4: 2022-02-02 08:29:26\n\u4f1a\u5458\u7b49\u7ea7: None\n\u4f1a\u5458\u8fc7\u671f\u65f6\u95f4: None\n\u4e2a\u4eba\u7b80\u4ecb:\n```\n\n# \u4f9d\u8d56\u5e93\n\n## \u5fc5\u987b\u4f9d\u8d56\n\n- httpx\uff1a\u7528\u4e8e\u5b9e\u73b0\u7f51\u7edc\u8bf7\u6c42\n- lxml\uff1a\u7528\u4e8e\u5b9e\u73b0\u57fa\u4e8e Xpath \u7684 HTML \u89e3\u6790\n\n## \u53ef\u9009\u4f9d\u8d56\n\n- ujson\uff1a\u5b89\u88c5\u540e\u5728\u5927\u91cf\u6570\u636e\u83b7\u53d6\u573a\u666f\u5c06\u83b7\u5f97\u4e00\u5b9a\u6027\u80fd\u63d0\u5347\n- tomd\uff1a\u5b89\u88c5\u540e\u53ef\u4ee5\u4f7f\u7528 `jrt.article.GetArticleMarkdown()` \u51fd\u6570\u83b7\u53d6 Markdown \u683c\u5f0f\u7684\u6587\u7ae0\u5185\u5bb9\n\n# \u8d21\u732e\n\n\u8be6\u89c1\u8d21\u732e\u6307\u5357\u6587\u4ef6\u3002\uff08CONTRIBUTING.md\uff09",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u79d1\u6280\u8d4b\u80fd\u521b\u4f5c\u661f\u8fb0",
"version": "2.11.0",
"split_keywords": [
"jianshu",
"sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ad107c8c535f07faf8ce76b3f2acdb9fb2a3ea822c83646e4a7e9cf7b6f9bcf0",
"md5": "7f92aa5d460a4b4a03abee62286238b5",
"sha256": "d0cdb7c05c59b04a53f2e96f3a99acd3c2f17e4749e1077024131fd403fa4058"
},
"downloads": -1,
"filename": "jianshuresearchtools-2.11.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7f92aa5d460a4b4a03abee62286238b5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 37951,
"upload_time": "2023-04-17T22:42:44",
"upload_time_iso_8601": "2023-04-17T22:42:44.385219Z",
"url": "https://files.pythonhosted.org/packages/ad/10/7c8c535f07faf8ce76b3f2acdb9fb2a3ea822c83646e4a7e9cf7b6f9bcf0/jianshuresearchtools-2.11.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9d5951737b50184c348c97eb7e9227a1f7ac2b0370d233b87cffdbcef4ede90d",
"md5": "fa6568781449fbbc25a5c38ac74fdfdf",
"sha256": "85ca89aa872ad4b0048256bc0c4540fff8d6304c0ec8d117460c60c35a7add88"
},
"downloads": -1,
"filename": "jianshuresearchtools-2.11.0.tar.gz",
"has_sig": false,
"md5_digest": "fa6568781449fbbc25a5c38ac74fdfdf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 29494,
"upload_time": "2023-04-17T22:42:46",
"upload_time_iso_8601": "2023-04-17T22:42:46.146029Z",
"url": "https://files.pythonhosted.org/packages/9d/59/51737b50184c348c97eb7e9227a1f7ac2b0370d233b87cffdbcef4ede90d/jianshuresearchtools-2.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-17 22:42:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "FHU-yezi",
"github_project": "JianshuResearchTools",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jianshuresearchtools"
}