From 0859bc1e8b94bb6ddc68b6c0c6bf28f555feecf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Wed, 26 Jun 2019 21:12:49 +0200 Subject: [PATCH] Updated CurseForge support --- CB/Core.py | 2 +- CB/CurseForge.py | 3 +-- CB/__init__.py | 2 +- CurseBreaker.py | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CB/Core.py b/CB/Core.py index 742a887..11f8ddf 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -233,7 +233,7 @@ def search(self, query): results = [] soup = BeautifulSoup(requests.get(f'https://www.curseforge.com/wow/addons/search?search=' f'{html.escape(query.strip())}').content, 'html.parser') - for row in soup.find_all('h2', attrs={'class': 'list-item__title strong mg-b-05'}): + for row in soup.find_all('h3', attrs={'class': 'text-primary-500 font-bold text-lg hover:no-underline'}): results.append(f'https://www.curseforge.com{row.parent["href"]}') return results diff --git a/CB/CurseForge.py b/CB/CurseForge.py index d3598c6..6c4ae0c 100644 --- a/CB/CurseForge.py +++ b/CB/CurseForge.py @@ -14,8 +14,7 @@ def __init__(self, url, cache, allowdev): project = cache[url] else: soup = BeautifulSoup(requests.get(url).content, 'html.parser') - project = re.findall(r'\d+', soup.find('a', attrs={'class': 'button button--icon button--twitch ' - 'download-button'})["data-nurture-data"])[0] + project = re.findall(r'\d+', soup.find('div', attrs={'class': 'w-full flex justify-between'}).text)[0] self.cacheID = project self.payload = requests.post('https://addons-ecs.forgesvc.net/api/v2/addon', json=[int(project)]).json()[0] self.name = self.payload['name'] diff --git a/CB/__init__.py b/CB/__init__.py index 39a36ee..0343233 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -1,4 +1,4 @@ -__version__ = '1.5.1' +__version__ = '1.5.2' __license__ = 'GPLv3' __copyright__ = '2019, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en' diff --git a/CurseBreaker.py b/CurseBreaker.py index acaf581..d219e84 100644 --- a/CurseBreaker.py +++ b/CurseBreaker.py @@ -241,8 +241,7 @@ def c_update(self, args, addline=False, update=True, force=False): versionold]) else: self.table_data.append([f'{Fore.YELLOW}{"Updated" if update else "Update available"}' - f'{Fore.RESET}', name, f'{versionold} {Fore.LIGHTBLACK_EX}>>' - f'>{Fore.RESET} {versionnew}']) + f'{Fore.RESET}', name, f'{Fore.YELLOW}{versionnew}{Fore.RESET}']) else: self.table_data.append([f'{Fore.LIGHTBLACK_EX}Not installed{Fore.RESET}', addon, '']) pbar.update(1)