首页 > 大数据 > 数据分析 > 小红书笔记数据API运用指南(点赞/收藏/评论获取)
App Key和
App Secret。red.note.detail.get)或“评论API”(如
v2/notes/{note_id}/comments)。https://api.xiaohongshu.com/note/detailhttps://api.xiaohongshu.com/v2/notes/{note_id}/commentsapi_key(App Key)、
note_id(笔记ID)、
access_token(授权令牌)。page、
page_size)、时间戳、签名(用于验证)。liked_count(点赞数)、
collected_count(收藏数)、
comment_count(评论数)等字段。pythonimport requestsdef get_note_data(api_key, note_id, access_token):url = f"https://api.xiaohongshu.com/note/detail?api_key={api_key}¬e_id={note_id}&access_token={access_token}"response = requests.get(url)if response.status_code == 200:data = response.json()return data.get('data', {}).get('note', {})else:raise Exception(f"请求失败: {response.text}")# 示例调用note_data = get_note_data("YOUR_API_KEY", "NOTE_ID_123", "ACCESS_TOKEN")print(f"点赞数: {note_data['liked_count']}, 收藏数: {note_data['collected_count']}")
edith.xiaohongshu.com/api/sns/web/v1/note/{note_id}),需注意反爬机制(User-Agent、IP代理、请求间隔)。liked_count、
collected_count、
comment_count,评论接口需遍历
comments列表提取内容。通过官方API或合规工具,可高效获取小红书笔记互动数据,需严格遵循平台规则与法律要求,确保数据使用的合法性与安全性。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70046834/viewspace-3096246/ ,如需转载,请注明出处,否则将追究法律责任。