ReaJason / xhs

基于小红书 Web 端进行的请求封装。https://reajason.github.io/xhs/
MIT License
1.15k stars 314 forks source link

I want to know the difference between these two functions. #135

Closed hezhenfan closed 22 hours ago

hezhenfan commented 1 day ago
def get_note_by_id(self, note_id: str):
    """
    :param note_id: note_id you want to fetch
    :type note_id: str
    :rtype: dict
    """
    data = {"source_note_id": note_id, "image_scenes": ["CRD_WM_WEBP"]}
    uri = "/api/sns/web/v1/feed"
    res = self.post(uri, data)
    return res["items"][0]["note_card"]

def get_note_by_id_from_html(self, note_id: str):
    """get note info from "https://www.xiaohongshu.com/explore/" + note_id,
    and the return obj is equal to get_note_by_id

    :param note_id: note_id you want to fetch
    :type note_id: str
    """
ReaJason commented 1 day ago

get_note_by_id 这个接口需要签名,通过 api 拿数据,和其他接口同等限制频率。

get_note_by_id_from_html 这个接口不需要签名,直接从 HTML 中提取。另外之前这个接口未授权也能拿到数据,不过后来修复了。

hezhenfan commented 1 day ago

感谢您的回复,谢谢。我还想知道接口限制频率是多少?一个账号每天最多200次访问吗?或者说一个账号每天可以抓取多少个笔记呢(不含评论)