xiaohongshu crawl sdk.
Project description
xhs is a crawling tool designed to extract data from xiaohongshu website
Usage
xhs is available on PyPI:
$ python -m pip install xhs
basic usage:
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)
# more functions in development
Please refer to the document(WIP) for more API references.
use signature function:
# sign get request
>>> from xhs import help
>>> help.sign("/api/sns/web/v1/user/otherinfo?target_user_id=5ff0e6410000000001008400")
{'x-s': '1l5LsiTlZYavOYwvOid6OlU6OisCZ6dBZjvL1gsCOg13', 'x-t': '1680701208022'}
# sign post request
>>> help.sign("/api/sns/web/v1/feed", {"source_note_id": "63db8819000000001a01ead1"})
{'x-s': 'sY5LOg9WOYFKsYFWOBcis2MlsiFCsjMb0jTKZja6OjA3', 'x-t': '1680701310666'}
# get search_id parameter
>>> help.get_search_id()
'2BHU39J8HCTIW665YHFCW'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xhs-0.1.1.tar.gz
(11.4 kB
view hashes)
Built Distribution
xhs-0.1.1-py3-none-any.whl
(9.0 kB
view hashes)