Skip to main content

xiaohongshu crawl sdk.

Project description

🍰xhs

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


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.0.4.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xhs-0.0.4-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file xhs-0.0.4.tar.gz.

File metadata

  • Download URL: xhs-0.0.4.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for xhs-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4262a6e8fe81f2b37a52ab3853f72b4fa51cfbd97c31236208b73812237fbd01
MD5 ca5ae8ae7e246fbbfa42b4d242d99160
BLAKE2b-256 5bda810af3c480425d7961c50ce201793c5567a76f329bad1da4b427d7b62439

See more details on using hashes here.

File details

Details for the file xhs-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: xhs-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for xhs-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1140d105f0f7e6d23b64bed777daac3a23f69d2c683b42c8ae38f230d0e61e7a
MD5 a8333874dd4f78f96a0986c47218cc43
BLAKE2b-256 c0ab1fb4afeeca23cbfb9da22341cac6c0356d40928b85c872f5150748cbde34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page