| | |
| | | browser_args["proxy"] = {"server": self.proxy} |
| | | self.browser = await playwright.chromium.launch(**browser_args) |
| | | if os.path.exists(self.cookie_path): |
| | | self.context = await self.browser.new_context(storage_state=f"{self.cookie_path}", user_agent=DEFAULT_USER_AGENT) |
| | | self.context = await self.browser.new_context(storage_state=f"{self.cookie_path}", user_agent=DEFAULT_USER_AGENT,viewport={"width": 1920, "height": 1080}) |
| | | else: |
| | | self.context = await self.browser.new_context(user_agent=DEFAULT_USER_AGENT) |
| | | self.context = await self.browser.new_context(user_agent=DEFAULT_USER_AGENT,viewport={"width": 1920, "height": 1080}) |
| | | if os.path.exists(PLAYWRIGHT_STEALTH_JS_PATH): |
| | | await self.context.add_init_script(path=Path(PLAYWRIGHT_STEALTH_JS_PATH)) |
| | | await self.context.grant_permissions(['geolocation']) |