fix: issue #19

This commit is contained in:
Relakkes 2023-07-25 20:22:22 +08:00
parent 7d63c2f9ec
commit 03565d61c6

View File

@ -48,6 +48,13 @@ class XiaoHongShuCrawler(AbstractCrawler):
)
# stealth.min.js is a js script to prevent the website from detecting the crawler.
await self.browser_context.add_init_script(path="libs/stealth.min.js")
# add a cookie attribute webId to avoid the appearance of a sliding captcha on the webpage
await self.browser_context.add_cookies([{
'name': "webId",
'value': "xxx123", # any value
'domain': ".xiaohongshu.com",
'path': "/"
}])
self.context_page = await self.browser_context.new_page()
await self.context_page.goto(self.index_url)