Skip to content

Commit 26a261b

Browse files
committed
Merge branch 'feature/config-refactor-20251018'
2 parents 56bf5d2 + 03e384b commit 26a261b

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

media_platform/bilibili/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ async def start(self):
7878
# Launch a browser context.
7979
chromium = playwright.chromium
8080
self.browser_context = await self.launch_browser(chromium, None, self.user_agent, headless=config.HEADLESS)
81-
# stealth.min.js is a js script to prevent the website from detecting the crawler.
82-
await self.browser_context.add_init_script(path="libs/stealth.min.js")
81+
# stealth.min.js is a js script to prevent the website from detecting the crawler.
82+
await self.browser_context.add_init_script(path="libs/stealth.min.js")
83+
8384
self.context_page = await self.browser_context.new_page()
8485
await self.context_page.goto(self.index_url)
8586

media_platform/douyin/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ async def start(self) -> None:
7474
user_agent=None,
7575
headless=config.HEADLESS,
7676
)
77-
# stealth.min.js is a js script to prevent the website from detecting the crawler.
78-
await self.browser_context.add_init_script(path="libs/stealth.min.js")
77+
# stealth.min.js is a js script to prevent the website from detecting the crawler.
78+
await self.browser_context.add_init_script(path="libs/stealth.min.js")
79+
7980
self.context_page = await self.browser_context.new_page()
8081
await self.context_page.goto(self.index_url)
8182

media_platform/kuaishou/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ async def start(self):
7878
self.browser_context = await self.launch_browser(
7979
chromium, None, self.user_agent, headless=config.HEADLESS
8080
)
81-
# stealth.min.js is a js script to prevent the website from detecting the crawler.
82-
await self.browser_context.add_init_script(path="libs/stealth.min.js")
81+
# stealth.min.js is a js script to prevent the website from detecting the crawler.
82+
await self.browser_context.add_init_script(path="libs/stealth.min.js")
83+
84+
8385
self.context_page = await self.browser_context.new_page()
8486
await self.context_page.goto(f"{self.index_url}?isHome=1")
8587

media_platform/weibo/core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ async def start(self):
7777
# Launch a browser context.
7878
chromium = playwright.chromium
7979
self.browser_context = await self.launch_browser(chromium, None, self.mobile_user_agent, headless=config.HEADLESS)
80-
# stealth.min.js is a js script to prevent the website from detecting the crawler.
81-
await self.browser_context.add_init_script(path="libs/stealth.min.js")
80+
81+
# stealth.min.js is a js script to prevent the website from detecting the crawler.
82+
await self.browser_context.add_init_script(path="libs/stealth.min.js")
83+
84+
8285
self.context_page = await self.browser_context.new_page()
8386
await self.context_page.goto(self.mobile_index_url)
8487

media_platform/xhs/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ async def start(self) -> None:
7979
self.user_agent,
8080
headless=config.HEADLESS,
8181
)
82-
# stealth.min.js is a js script to prevent the website from detecting the crawler.
83-
await self.browser_context.add_init_script(path="libs/stealth.min.js")
82+
# stealth.min.js is a js script to prevent the website from detecting the crawler.
83+
await self.browser_context.add_init_script(path="libs/stealth.min.js")
84+
8485
self.context_page = await self.browser_context.new_page()
8586
await self.context_page.goto(self.index_url)
8687

media_platform/zhihu/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ async def start(self) -> None:
8686
self.browser_context = await self.launch_browser(
8787
chromium, None, self.user_agent, headless=config.HEADLESS
8888
)
89-
# stealth.min.js is a js script to prevent the website from detecting the crawler.
90-
await self.browser_context.add_init_script(path="libs/stealth.min.js")
89+
# stealth.min.js is a js script to prevent the website from detecting the crawler.
90+
await self.browser_context.add_init_script(path="libs/stealth.min.js")
9191

9292
self.context_page = await self.browser_context.new_page()
9393
await self.context_page.goto(self.index_url, wait_until="domcontentloaded")

0 commit comments

Comments
 (0)