|
@@ -34,12 +34,13 @@ class XhsBrowser(BaseBrowser):
|
|
|
|
|
|
|
|
|
self.rotate_ident.handle_rotate()
|
|
|
- self.browser.add_cookies([{
|
|
|
- 'name': "webId",
|
|
|
- 'value': "xxx123",
|
|
|
- 'domain': ".xiaohongshu.com",
|
|
|
- 'path': "/"
|
|
|
- }])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -89,7 +90,11 @@ class XhsBrowser(BaseBrowser):
|
|
|
|
|
|
def get_note(self, note_id: str):
|
|
|
|
|
|
- self.page.goto(f'{XHS_URL}/explore/{note_id}', wait_until='domcontentloaded')
|
|
|
+ url = f'{XHS_URL}/explore/{note_id}'
|
|
|
+ self.page.goto(url)
|
|
|
+ if self.page.url != url:
|
|
|
+ self.page.locator('.note-item').nth(0).click()
|
|
|
+ self.page.goto(url)
|
|
|
self.rotate_ident.handle_rotate()
|
|
|
data = self.page.evaluate('noteId => window.__INITIAL_STATE__ && JSON.stringify(window.__INITIAL_STATE__.note.noteDetailMap[noteId].note)', note_id)
|
|
|
return json.loads(data)
|