Created
November 22, 2018 23:22
-
-
Save spookyahell/80190b88a798f9bb9ab7929352b33c53 to your computer and use it in GitHub Desktop.
Download latest portable x64 version of mkvmerge & Co
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
import json | |
s = requests.Session() | |
site = 'https://www.fosshub.com/' | |
downloadAPP = 'MKVToolNix.html' | |
downloadsite = site + downloadAPP | |
r = s.get(downloadsite) | |
#~ print('var settings' in r.text) | |
x = re.search(r'var settings =(.+)$',r.text, re.M) | |
settings_text = x.group(1) | |
settings = json.loads(settings_text) | |
pool = settings['pool'] | |
f = pool['f'] | |
p = pool['p'] | |
def download(p, r, n): | |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0', | |
'Referer': 'https://www.fosshub.com/', | |
'Origin': 'https://www.fosshub.com'} | |
r = s.post('https://api.fosshub.com/download/', | |
json = {"projectId":p,"releaseId":r,"projectUri":downloadAPP,"fileName":n,"isLatestVersion":True}) | |
jso = r.json() | |
error = jso['error'] | |
if error is None: | |
data = jso['data'] | |
URL = data['url'] | |
print(URL) | |
for file in f: | |
name = file['n'] | |
rc = file['r'] | |
x = re.fullmatch('mkvtoolnix-64-bit-(.+).7z', name) | |
if x: | |
download(p, rc, name) | |
break | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment