MCPcopy Create free account
hub / github.com/LumingMelody/JS_reverse / get_comment

Function get_comment

red_book_comment.py:49–70  ·  view source on GitHub ↗
(source_note_id)

Source from the content-addressed store, hash-verified

47
48
49def get_comment(source_note_id):
50 get_xs(source_note_id)
51 response = requests.get(
52 f'https://edith.xiaohongshu.com/api/sns/web/v2/comment/page?note_id={source_note_id}&cursor=',
53 headers=headers).json()
54 print(response)
55 while response['data']['has_more']:
56 comments = response['data']['comments']
57 for comment in comments:
58 nick_name = comment['user_info']['nickname']
59 content = comment['content']
60 note_id = comment['note_id']
61 ws.append([nick_name, content, note_id])
62 print(nick_name, content, note_id)
63 cursor = response['data']['cursor']
64 get_xs(source_note_id, cursor)
65 response = requests.get(
66 f'https://edith.xiaohongshu.com/api/sns/web/v2/comment/page?note_id={source_note_id}&cursor={cursor}',
67 headers=headers).json()
68 print(response)
69 wb.save(r'./data/red_book_comment.xlsx')
70 time.sleep(2)
71
72
73# /api/sns/web/v2/comment/page?note_id=640070c90000000013001b92&cursor=64084ec5000000000b0300e6

Callers 1

Calls 1

get_xsFunction · 0.70

Tested by

no test coverage detected