<div align="center">
<h1 align="center">
ð°xhs
</h1>
[![PyPI](https://img.shields.io/pypi/v/xhs?label=xhs)](https://pypi.org/project/xhs/)
[![](https://static.pepy.tech/badge/xhs)](https://pepy.tech/project/xhs)
[![](https://img.shields.io/github/license/ReaJason/xhs)](https://github.com/ReaJason/xhs/blob/master/LICENSE)
<br /> [![](https://github.com/ReaJason/xhs/actions/workflows/doc.yml/badge.svg)](https://reajason.github.io/xhs/)
[![](https://github.com/ReaJason/xhs/actions/workflows/test.yml/badge.svg)](https://github.com/ReaJason/xhs/actions/workflows/test.yml)
[![](https://github.com/ReaJason/xhs/actions/workflows/pypi.yml/badge.svg)](https://github.com/ReaJason/xhs/actions/workflows/pypi.yml)
</div>
> **Warning**
>
> I sincerely apologize for informing you that the sign is not functioning properly, indicating that certain APIs are experiencing issues. To address the anti-aliasing of the sign, I will devote time to further learning. ð
>
> This is in expriemental, so the api is not stable, every update should be cautious
**xhs** is a crawling tool designed to extract data from [xiaohongshu website](https://www.xiaohongshu.com/explore)
## Usage
xhs is available on PyPI:
```console
$ python -m pip install xhs
```
basic usage:
```python
from xhs import FeedType, XhsClient
cookie = "please get cookie in website"
xhs_client = XhsClient(cookie)
# get note info
note_info = xhs_client.get_note_by_id("63db8819000000001a01ead1")
# get user info
user_info = xhs_client.get_user_info("5ff0e6410000000001008400")
# get user notes
user_notes = xhs_client.get_user_notes("63273a77000000002303cc9b")
# search note
notes = xhs_client.get_note_by_keyword("å°çº¢ä¹¦")
# get home recommend feed
recommend_type = FeedType.RECOMMEND
recommend_notes = xhs_client.get_home_feed(recommend_type)
# save notes file in disk
xhs_client.save_files_from_note_id("63db8819000000001a01ead1",
r"C:\Users\User\Desktop"
# get user all note detail
notes = xhs_client.get_user_all_notes("5c2766b500000000050283f1")
# more functions in development
```
Please refer to the [document(WIP)](https://reajason.github.io/xhs/) for more API references.
use signature function:
```python
# sign get request
>>> from xhs import help
>>> help.sign("/api/sns/web/v1/user/otherinfo?target_user_id=5ff0e6410000000001008400")
{'x-s': 'sYMlOB5W0YdvZBVvOBw6slZJZjM+ZgaUOlFisBwJslc3', 'x-t': '1683368960336', 'x-s-common': '2UQAPsHC+aIjqArjwjHjNsQhPsHCH0rjNsQhPaHCH0P1PjhIHjIj2eHjwjQgynEDJ74AHjIj2ePjwjQhyoPTqBPT49pjHjIj2ecjwjHUN0P1PaHVHdWMH0ijHjIj2eGjwjHl+0W
APAGhw/GIPAP9HjIj2eqjwjQAnLMV/FHMpAm88o8ycS89/FQ7+d+VnDkyyDF3nf4YpLRVzfSAcd4tq9l0PUHVHdWhH0ijHjIj2eDjwjFAPAPU+eHMweDANsQhP/Zjw0bR'}
# sign post request
>>> help.sign("/api/sns/web/v1/feed", {"source_note_id": "63db8819000000001a01ead1"})
{'x-s': '1lU6sBdUOY5WZY5Ksg9G0Yw60jwBOlFWZj5W0jM+slc3', 'x-t': '1683368998055', 'x-s-common': '2UQAPsHC+aIjqArjwjHjNsQhPsHCH0rjNsQhPaHCH0P1PjhIHjIj2eHjwjQgynEDJ74AHjIj2ePjwjQhyoPTqBPT49pjHjIj2ecjwjHUN0P1PaHVHdWMH0ijHjIj2eGjwjHl+0W
APAGhw/DhPeLMHjIj2eqjwjHlJbL9qFQDpLR8+p4yn/pNq9qEzAm84AGIyd4s/9lBpMkx+pqIyDF3q9l0PUHVHdWhH0ijHjIj2eDjwjFlP0DEw/DFPeDANsQhP/Zjw0bR'}
# generate a1 and webId, but it not useful until you sign them
>>> help.get_a1_and_web_id()
('187f09d3bc6wUrNpFbQ9Yc431AenpvlBJh2QIQahI50000261040', '12b49a1fd517aa8df85380e9961b6800')
# get search_id parameter
>>> help.get_search_id()
'2BHU39J8HCTIW665YHFCW'
```
## Donate
[![](https://afdian.net/static/img/logo/logo.png)](https://afdian.net/a/reajason)
xhs-小红书数据采集python算法还原
1星 需积分: 5 79 浏览量
2023-05-14
20:32:03
上传
评论 8
收藏 28KB ZIP 举报
洛哥爬虫
- 粉丝: 119
- 资源: 2
最新资源
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
- 音乐展示网页、基于Stenography的图像数字水印添加与提取,以及基于颜色矩和Tamura算法的图像相似度评估算法py源码
- 基于EmguCV(OpenCV .net封装),图像数字水印加解密算法的实现,其中包含最低有效位算法,离散傅里叶变换算法+文档书
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈