From ebf8b6ac044a8e0d14e6acb1f2d338abd86cbb7a Mon Sep 17 00:00:00 2001 From: Kuucheen <70746714+Kuucheen@users.noreply.github.com> Date: Sat, 20 Aug 2022 22:57:56 +0200 Subject: [PATCH] Add files via upload --- KC-Scraper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/KC-Scraper.py b/KC-Scraper.py index 14d1dd9..48a2dd2 100644 --- a/KC-Scraper.py +++ b/KC-Scraper.py @@ -5,7 +5,7 @@ try: import httpx, yaml from pystyle import Colors, Colorate, Center except ImportError: - os.system('python -m pip install httpx') + os.system('python -m pip install httpx[http2]') os.system('python -m pip install pyyaml') os.system('python -m pip install pystyle') import httpx, yaml @@ -184,10 +184,8 @@ def scrape(site: str): try: with httpx.Client(http2=True,headers = {'accept-language': 'en','user-agent':random.choice(uas)},follow_redirects=True) as client: r = client.get(site, timeout=10).text - except ConnectionError: + except: print(f"{white}[{Colors.red}!{white}] Failed connecting to {color}{site}") - except TimeoutError: - print(f"{white}[{Colors.red}!{white}] Timeout at {color}{site}") else: print(f"{white}[{Colors.green}+{white}] Scraping {color}{site}") if clearing == True: