From f7add90beecea07bf775a083f25dfe18ea4c0294 Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 21 Apr 2023 11:31:45 -0200 Subject: [PATCH] fix(route): xiaohongshu private collection (#12366) --- lib/v2/xiaohongshu/util.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/v2/xiaohongshu/util.js b/lib/v2/xiaohongshu/util.js index 7793070234..798b31058f 100644 --- a/lib/v2/xiaohongshu/util.js +++ b/lib/v2/xiaohongshu/util.js @@ -31,7 +31,10 @@ const getUser = (url, cache) => await page.goto(url); await page.waitForSelector('.feeds-container:nth-child(1) .note-item'); await page.click('div.reds-tab-item:nth-child(2)'); - await page.waitForSelector('.feeds-container:nth-child(2) .note-item'); + const privateCollection = await page.evaluate(() => document.querySelector('div.reds-tab-item:nth-child(2) .reds-icon')); + if (!privateCollection) { + await page.waitForSelector('.feeds-container:nth-child(2) .note-item'); + } return { otherInfo, user_posted, collect }; } finally { browser.close();