Skip to content

🕷️ 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

fix: remove forgotten unused code

Karim shoair9bfe74484069
diff --git a/scrapling/core/translator.py b/scrapling/core/translator.py
index bb6d405..c34ed7d 100644
--- a/scrapling/core/translator.py
+++ b/scrapling/core/translator.py
@@ -130,5 +130,5 @@ translator = HTMLTranslator()
@lru_cache(maxsize=256)
def css_to_xpath(query: str) -> str:
- """Return translated XPath version of a given CSS query"""
+ """Return the translated XPath version of a given CSS query"""
return translator.css_to_xpath(query)
diff --git a/scrapling/engines/_browsers/_config_tools.py b/scrapling/engines/_browsers/_config_tools.py
index b2501ec..2d7691b 100644
--- a/scrapling/engines/_browsers/_config_tools.py
+++ b/scrapling/engines/_browsers/_config_tools.py
@@ -1,11 +1,5 @@
from functools import lru_cache
-from scrapling.core._types import Tuple
-from scrapling.engines.constants import (
- DEFAULT_STEALTH_FLAGS,
- HARMFUL_DEFAULT_ARGS,
- DEFAULT_FLAGS,
-)
from scrapling.engines.toolbelt.navigation import js_bypass_path
from scrapling.engines.toolbelt.fingerprints import generate_headers
@@ -42,19 +36,3 @@ def _compiled_stealth_scripts():
with open(script_path, "r") as f:
scripts.append(f.read())
return tuple(scripts)
-
-
-@lru_cache(2, typed=True)
-def _set_flags(hide_canvas, disable_webgl): # pragma: no cover
- """Returns the flags that will be used while launching the browser if stealth mode is enabled"""
- flags = DEFAULT_STEALTH_FLAGS
- if hide_canvas:
- flags += ("--fingerprinting-canvas-image-data-noise",)
- if disable_webgl:
- flags += (
- "--disable-webgl",
- "--disable-webgl-image-chromium",
- "--disable-webgl2",
- )
-
- return flags
diff --git a/scrapling/engines/_browsers/_validators.py b/scrapling/engines/_browsers/_validators.py
index b5740b4..82270ef 100644
--- a/scrapling/engines/_browsers/_validators.py
+++ b/scrapling/engines/_browsers/_validators.py
@@ -13,7 +13,6 @@ from scrapling.core._types import (
Tuple,
Optional,
Callable,
- Iterable,
Sequence,
overload,
SetCookieParam,
@@ -37,15 +36,6 @@ def _is_invalid_file_path(value: str) -> bool | str: # pragma: no cover
return False
-def _validate_addon_path(value: str) -> None: # pragma: no cover
- """Fast addon path validation"""
- path = Path(value)
- if not path.exists():
- raise FileNotFoundError(f"Addon path not found: {value}")
- if not path.is_dir():
- raise ValueError(f"Addon path must be a directory of the extracted addon: {value}")
-
-
@lru_cache(2)
def _is_invalid_cdp_url(cdp_url: str) -> bool | str:
"""Fast CDP URL validation"""
diff --git a/scrapling/engines/toolbelt/navigation.py b/scrapling/engines/toolbelt/navigation.py
index 9aa91dd..1b44f5a 100644
--- a/scrapling/engines/toolbelt/navigation.py
+++ b/scrapling/engines/toolbelt/navigation.py
@@ -11,7 +11,7 @@ from msgspec import Struct, structs, convert, ValidationError
from playwright.sync_api import Route
from scrapling.core.utils import log
-from scrapling.core._types import Dict, Tuple, overload, Literal
+from scrapling.core._types import Dict, Tuple
from scrapling.engines.constants import DEFAULT_DISABLED_RESOURCES
__BYPASSES_DIR__ = Path(__file__).parent / "bypasses"