diff --git a/CB/Core.py b/CB/Core.py index 56a61e6..9f04329 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -11,7 +11,7 @@ import zipfile import datetime import requests -import cfscrape +import cloudscraper from tqdm import tqdm from pathlib import Path from checksumdir import dirhash @@ -340,7 +340,7 @@ def parse_cf_id(self, url): if slug in self.cfIDs: project = self.cfIDs[slug] else: - scraper = cfscrape.create_scraper() + scraper = cloudscraper.create_scraper() payload = scraper.get(url + '/download-client') if payload.status_code == 404: raise RuntimeError(slug) diff --git a/CB/CurseForge.py b/CB/CurseForge.py index 873bf30..cc3632b 100644 --- a/CB/CurseForge.py +++ b/CB/CurseForge.py @@ -2,6 +2,7 @@ import io import zipfile import requests +import cloudscraper from . import retry, HEADERS from operator import itemgetter @@ -27,6 +28,7 @@ def __init__(self, project, checkcache, clienttype, allowdev): self.currentVersion = None self.archive = None self.directories = [] + self.scraper = cloudscraper.create_scraper() self.get_current_version() def get_current_version(self): @@ -45,7 +47,7 @@ def get_current_version(self): @retry() def get_addon(self): - self.archive = zipfile.ZipFile(io.BytesIO(requests.get(self.downloadUrl, headers=HEADERS).content)) + self.archive = zipfile.ZipFile(io.BytesIO(self.scraper.get(self.downloadUrl).content)) for file in self.archive.namelist(): if '/' not in os.path.dirname(file): self.directories.append(os.path.dirname(file)) diff --git a/CB/WoWInterface.py b/CB/WoWInterface.py index 4c19ed5..c4e3c2b 100644 --- a/CB/WoWInterface.py +++ b/CB/WoWInterface.py @@ -3,6 +3,7 @@ import re import zipfile import requests +import cloudscraper from . import retry, HEADERS @@ -24,10 +25,11 @@ def __init__(self, url, checkcache): self.currentVersion = self.payload['UIVersion'] self.archive = None self.directories = [] + self.scraper = cloudscraper.create_scraper() @retry() def get_addon(self): - self.archive = zipfile.ZipFile(io.BytesIO(requests.get(self.downloadUrl, headers=HEADERS).content)) + self.archive = zipfile.ZipFile(io.BytesIO(self.scraper.get(self.downloadUrl).content)) for file in self.archive.namelist(): if '/' not in os.path.dirname(file): self.directories.append(os.path.dirname(file)) diff --git a/CB/__init__.py b/CB/__init__.py index 6e427c2..110a5c3 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -1,7 +1,7 @@ import string import random -__version__ = '3.1.2' +__version__ = '3.1.3' __license__ = 'GPLv3' __copyright__ = '2019-2020, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en' diff --git a/requirements.txt b/requirements.txt index c97bed6..ff8cc00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ terminaltables prompt_toolkit +cloudscraper checksumdir -cfscrape requests tqdm lupa \ No newline at end of file