diff options
author | Alexander Hayden <alexhayden25@gmail.com> | 2019-10-07 16:32:58 -0400 |
---|---|---|
committer | Alexander Hayden <alexhayden25@gmail.com> | 2019-10-07 16:32:58 -0400 |
commit | e0b9b289727c98d2ae683a09b26f606180412500 (patch) | |
tree | 8e9eae1907d8c2de7f3194a827e6a575ef0567fa | |
parent | 1b8a1a4ddfe5c6ff2649fe5d532b22e7bb656cd8 (diff) | |
download | modpackman-e0b9b289727c98d2ae683a09b26f606180412500.tar.gz modpackman-e0b9b289727c98d2ae683a09b26f606180412500.zip |
Fix update.py
-rwxr-xr-x | update.py | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -103,7 +103,7 @@ def apply_updates(args): else: url = requests.get(mod[1]).url if url is None: - print('Failed to fetch {mod[0]}!'.format(mod=mod)) + print('[!]Failed to fetch {mod[0]}!'.format(mod=mod)) continue resp = requests.get(url) hsh = hashlib.sha1(resp.content).hexdigest() @@ -147,19 +147,19 @@ def check_updates(args): # Use selenium to find curseforge CDN links around cloudflare def find_cdn(ffx, url): try: - ffx.get(url + '/download') - page_src = ffx.page_source - dl = re.search('Elerium.PublicProjectDownload.countdown\(".*?"\);', page_src) - if not dl: - return None - dl = re.search('\d+', dl.group(0).split('"')[1]) + #ffx.get(url + '/download') + ffx.get(url + '/files') + #page_src = ffx.page_source + #dl = re.search('Elerium.PublicProjectDownload.countdown\(".*?"\);', page_src) + #if not dl: + # return None + dl = ffx.find_element_by_xpath("html/body/div/main/div/div/section/div/div/div/section/article/div/div/a").get_attribute("href") + dl = re.search('\d{7}', dl) dl = dl.group(0) four = str(int(dl[:4])) three = str(int(dl[4:])) - ffx.get(url + '/files') - elements = ffx.find_elements_by_tag_name('tr') - file_name = elements[1].find_element_by_tag_name('a').text + file_name = ffx.find_elements_by_xpath("html/body/div/main/div/div/section/div/div/div/section/article/div/div/span[contains(@class, 'text-sm')]")[1].text return 'https://media.forgecdn.net/files/{four}/{three}/{jar}'.format(four=four,three=three,jar=file_name) except: |