import re import time def get_domain(url): GDRIVE_DOMAIN = "drive.google.com" if GDRIVE_DOMAIN in url: domain = "GD" return domain else: print("Il link inserito non sembra essere un link Google Drive!") def get_google_url(url): file_id = re.search('/d/(.+?)/view',url) if file_id: file_gdrive = file_id.group(1) return file_gdrive else: print("Errore!") def get_gdrive_direct_link(file_gdrive): DLINK = "https://drive.google.com/uc?export=view&id=" direct_url = DLINK + file_gdrive return direct_url def get_link(url): file_gdrive = get_google_url(url) direct_link = get_gdrive_direct_link(file_gdrive) print(f"Direct Link Download : {direct_link}") while True: url = input("Inserisci un URL Google Drive : ") domain = get_domain(url) if domain == "GD": get_link(url) altri_link = input("Desideri Inserire un'altro link Google Drive? ") if altri_link != "Si" and altri_link != "si": print("Sto uscendo dal programma...") time.sleep(0.3) break