🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
feat(dynamicSession): add the option to set timezone of the browser
Karim shoair39f544eae440
diff --git a/scrapling/engines/_browsers/_base.py b/scrapling/engines/_browsers/_base.pyindex 7aa5aeb..fdb298c 100644--- a/scrapling/engines/_browsers/_base.py+++ b/scrapling/engines/_browsers/_base.py@@ -281,6 +281,7 @@ class DynamicSessionMixin:self._wait_selector_state = config.wait_selector_stateself._extra_flags = config.extra_flagsself._selector_config = config.selector_config+ self._timezone_id = config.timezone_idself._additional_args = config.additional_argsself._page_action = config.page_actionself._user_data_dir = config.user_data_dir@@ -304,6 +305,7 @@ class DynamicSessionMixin:self._stealth,self._hide_canvas,self._disable_webgl,+ self._timezone_id,tuple(self._extra_flags) if self._extra_flags else tuple(),))diff --git a/scrapling/engines/_browsers/_config_tools.py b/scrapling/engines/_browsers/_config_tools.pyindex 57e2f17..eaf28d6 100644--- a/scrapling/engines/_browsers/_config_tools.py+++ b/scrapling/engines/_browsers/_config_tools.py@@ -70,6 +70,7 @@ def _launch_kwargs(stealth,hide_canvas,disable_webgl,+ timezone_id,extra_flags: Tuple,) -> Tuple:"""Creates the arguments we will use while launching playwright's browser"""@@ -79,6 +80,7 @@ def _launch_kwargs(launch_kwargs = {"locale": locale,+ "timezone_id": timezone_id or None,"headless": headless,"args": base_args,"color_scheme": "dark", # Bypasses the 'prefersLightColor' check in creepjsdiff --git a/scrapling/engines/_browsers/_validators.py b/scrapling/engines/_browsers/_validators.pyindex a867a37..f8b9875 100644--- a/scrapling/engines/_browsers/_validators.py+++ b/scrapling/engines/_browsers/_validators.py@@ -87,6 +87,7 @@ class PlaywrightConfig(Struct, kw_only=True, frozen=False, weakref=True):load_dom: bool = Truewait_selector_state: SelectorWaitStates = "attached"user_data_dir: str = ""+ timezone_id: str = ""extra_flags: Optional[List[str]] = Noneselector_config: Optional[Dict] = {}additional_args: Optional[Dict] = {}