diff --git a/README.md b/README.md index f299b3b..c08d02f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🕷️ Scrapling: Undetectable, Lightning-Fast, and Adaptive Web Scraping for Python +# 🕷️ Scrapling: Undetectable, Lightning-Fast, and Easy Web Scraping with Python [![Tests](https://github.com/D4Vinci/Scrapling/actions/workflows/tests.yml/badge.svg)](https://github.com/D4Vinci/Scrapling/actions/workflows/tests.yml) [![PyPI version](https://badge.fury.io/py/Scrapling.svg)](https://badge.fury.io/py/Scrapling) [![Supported Python versions](https://img.shields.io/pypi/pyversions/scrapling.svg)](https://pypi.org/project/scrapling/) [![PyPI Downloads](https://static.pepy.tech/badge/scrapling)](https://pepy.tech/project/scrapling) Dealing with failing web scrapers due to anti-bot protections or website changes? Meet Scrapling. diff --git a/scrapling/__init__.py b/scrapling/__init__.py index c6908db..13b01fe 100644 --- a/scrapling/__init__.py +++ b/scrapling/__init__.py @@ -5,7 +5,7 @@ from scrapling.fetchers import (AsyncFetcher, CustomFetcher, Fetcher, from scrapling.parser import Adaptor, Adaptors __author__ = "Karim Shoair (karim.shoair@pm.me)" -__version__ = "0.2.95" +__version__ = "0.2.96" __copyright__ = "Copyright (c) 2024 Karim Shoair" diff --git a/scrapling/cli.py b/scrapling/cli.py index 7d22f0c..58ad43c 100644 --- a/scrapling/cli.py +++ b/scrapling/cli.py @@ -12,13 +12,14 @@ def get_package_dir(): def run_command(command, line): print(f"Installing {line}...") - _ = subprocess.check_call(command, shell=True) + _ = subprocess.check_call(' '.join(command), shell=True) # I meant to not use try except here @click.command(help="Install all Scrapling's Fetchers dependencies") -def install(): - if not get_package_dir().joinpath(".scrapling_dependencies_installed").exists(): +@click.option('-f', '--force', 'force', is_flag=True, default=False, type=bool, help="Force Scrapling to reinstall all Fetchers dependencies") +def install(force): + if force or not get_package_dir().joinpath(".scrapling_dependencies_installed").exists(): run_command([sys.executable, "-m", "playwright", "install", 'chromium'], 'Playwright browsers') run_command([sys.executable, "-m", "playwright", "install-deps", 'chromium', 'firefox'], 'Playwright dependencies') run_command([sys.executable, "-m", "camoufox", "fetch", '--browserforge'], 'Camoufox browser and databases') diff --git a/scrapling/core/custom_types.py b/scrapling/core/custom_types.py index 30f61e1..67e4e00 100644 --- a/scrapling/core/custom_types.py +++ b/scrapling/core/custom_types.py @@ -23,19 +23,8 @@ class TextHandler(str): return super().__new__(cls, string) return super().__new__(cls, '') - @typing.overload - def __getitem__(self, key: SupportsIndex) -> 'TextHandler': - pass - - @typing.overload - def __getitem__(self, key: slice) -> "TextHandlers": - pass - - def __getitem__(self, key: Union[SupportsIndex, slice]) -> Union["TextHandler", "TextHandlers"]: + def __getitem__(self, key: Union[SupportsIndex, slice]) -> "TextHandler": lst = super().__getitem__(key) - if isinstance(key, slice): - lst = [TextHandler(s) for s in lst] - return TextHandlers(typing.cast(List[_TextHandlerType], lst)) return typing.cast(_TextHandlerType, TextHandler(lst)) def split(self, sep: str = None, maxsplit: SupportsIndex = -1) -> 'TextHandlers': diff --git a/setup.cfg b/setup.cfg index ad4de36..cf8a52f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = scrapling -version = 0.2.95 +version = 0.2.96 author = Karim Shoair author_email = karim.shoair@pm.me description = Scrapling is an undetectable, powerful, flexible, high-performance Python library that makes Web Scraping easy again! diff --git a/setup.py b/setup.py index 81afabd..cb2ff3d 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setup( name="scrapling", - version="0.2.95", + version="0.2.96", description="""Scrapling is an undetectable, powerful, flexible, high-performance Python library that makes Web Scraping easy again! In an internet filled with complications, it simplifies web scraping, even when websites' design changes, while providing impressive speed that surpasses almost all alternatives.""", long_description=long_description,