#!/usr/bin/env python3 import argparse import requests import sys # Handle arguments argparser = argparse.ArgumentParser( description = "Command line utility to interact with downloadgemist.nl", ) argparser.add_argument("url") args = argparser.parse_args() # Make the actual HTTP request form = requests.post( "https://www.downloadgemist.nl/core/hyperbridge.php", data={ "mode": "initiate", "link": args.url, "options": '{"size":"large","download_tt888":true}', }, ) # Make sure the response is json if form.headers.get("Content-Type").lower() != "application/json": print("oh no") sys.exit(1) json = form.json() print(form.json()) # Handle any errors if json["status"] == 1: print(form.json()["error"]) sys.exit(form.json()["status"]) # Write the downloaded file video = requests.get(json["file"]) open(json["filename"], "wb").write(video.content)