@@ -43,6 +43,14 @@ def get_note_detail_v7(self, note_id: str):
43
43
}
44
44
return request_util .get_request (url , params )
45
45
46
+ def get_note_detail_v8 (self , note_id : str ):
47
+ url = f"{ config .BASE_URL } /api/xiaohongshu/get-note-detail/v8"
48
+ params = {
49
+ "token" : self .token ,
50
+ "noteId" : note_id ,
51
+ }
52
+ return request_util .get_request (url , params )
53
+
46
54
def get_note_comment_v2 (self , note_id : str , last_cursor : str = None ):
47
55
url = f"{ config .BASE_URL } /api/xiaohongshu/get-note-comment/v2"
48
56
params = {
@@ -63,6 +71,26 @@ def get_note_comment_v2(self, note_id: str, last_cursor: str = None):
63
71
logger .warning (f"Pagination parse error at { url } . Contact us to fix it." )
64
72
return result , data , message , has_next_page
65
73
74
+ def get_note_comment_v3 (self , note_id : str , last_cursor : str = None ):
75
+ url = f"{ config .BASE_URL } /api/xiaohongshu/get-note-comment/v3"
76
+ params = {
77
+ "token" : self .token ,
78
+ "noteId" : note_id ,
79
+ }
80
+ if last_cursor :
81
+ params ["lastCursor" ] = last_cursor
82
+
83
+ has_next_page = False
84
+ result , data , message = request_util .get_request_page (url , params )
85
+ try :
86
+ if data :
87
+ has_more = data .get ("has_more" )
88
+ if has_more is not None and isinstance (has_more , bool ) and has_more is True :
89
+ has_next_page = True
90
+ except Exception as e :
91
+ logger .warning (f"Pagination parse error at { url } . Contact us to fix it." )
92
+ return result , data , message , has_next_page
93
+
66
94
def get_note_sub_comment_v2 (self , note_id : str , comment_id : str , last_cursor : str = None ):
67
95
url = f"{ config .BASE_URL } /api/xiaohongshu/get-note-sub-comment/v2"
68
96
params = {
@@ -84,6 +112,27 @@ def get_note_sub_comment_v2(self, note_id: str, comment_id: str, last_cursor: st
84
112
logger .warning (f"Pagination parse error at { url } . Contact us to fix it." )
85
113
return result , data , message , has_next_page
86
114
115
+ def get_note_sub_comment_v3 (self , note_id : str , comment_id : str , last_cursor : str = None ):
116
+ url = f"{ config .BASE_URL } /api/xiaohongshu/get-note-sub-comment/v3"
117
+ params = {
118
+ "token" : self .token ,
119
+ "noteId" : note_id ,
120
+ "commentId" : comment_id ,
121
+ }
122
+ if last_cursor :
123
+ params ["lastCursor" ] = last_cursor
124
+
125
+ has_next_page = False
126
+ result , data , message = request_util .get_request_page (url , params )
127
+ try :
128
+ if data :
129
+ has_more = data .get ("has_more" )
130
+ if has_more is not None and isinstance (has_more , bool ) and has_more is True :
131
+ has_next_page = True
132
+ except Exception as e :
133
+ logger .warning (f"Pagination parse error at { url } . Contact us to fix it." )
134
+ return result , data , message , has_next_page
135
+
87
136
def search_note_v2 (self , keyword : str , page : int , sort : str , note_type : str , note_time : str = None ):
88
137
url = f"{ config .BASE_URL } /api/xiaohongshu/search-note/v2"
89
138
params = {
@@ -108,6 +157,28 @@ def search_note_v2(self, keyword: str, page: int, sort: str, note_type: str, not
108
157
logger .warning (f"Pagination parse error at { url } . Contact us to fix it." )
109
158
return result , data , message , has_next_page
110
159
160
+ def search_note_v3 (self , keyword : str , page : int , sort : str , note_type : str ):
161
+ url = f"{ config .BASE_URL } /api/xiaohongshu/search-note/v3"
162
+ params = {
163
+ "token" : self .token ,
164
+ "keyword" : keyword ,
165
+ "page" : page ,
166
+ "sort" : sort ,
167
+ "noteType" : note_type ,
168
+ }
169
+
170
+ has_next_page = False
171
+ result , data , message = request_util .get_request_page (url , params )
172
+ try :
173
+ if data :
174
+ if data .get ("items" ):
175
+ has_more = data .get ("has_more" )
176
+ if has_more is None or (isinstance (has_more , bool ) and has_more is True ):
177
+ has_next_page = True
178
+ except Exception as e :
179
+ logger .warning (f"Pagination parse error at { url } . Contact us to fix it." )
180
+ return result , data , message , has_next_page
181
+
111
182
def search_user_v2 (self , keyword : str , page : int ):
112
183
url = f"{ config .BASE_URL } /api/xiaohongshu/search-user/v2"
113
184
params = {
0 commit comments