fix: issue #19
This commit is contained in:
parent
7d63c2f9ec
commit
03565d61c6
@ -48,6 +48,13 @@ class XiaoHongShuCrawler(AbstractCrawler):
|
|||||||
)
|
)
|
||||||
# stealth.min.js is a js script to prevent the website from detecting the crawler.
|
# 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")
|
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()
|
self.context_page = await self.browser_context.new_page()
|
||||||
await self.context_page.goto(self.index_url)
|
await self.context_page.goto(self.index_url)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user