Created
May 26, 2024 20:52
-
-
Save ohusq/e0669cb582895034cc5e07adec7acf34 to your computer and use it in GitHub Desktop.
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
from os import system | |
from pathlib import Path | |
def curl(url : str, filename : str, path : str): | |
if url == "": | |
return | |
print(f"cURL attempt on {url}") | |
call = system(f'cd {path} && curl "{url}" -o "{filename}"') | |
if call == 0: | |
print("Downloaded the file succesfully!") | |
else: | |
print("Failed to download your file!") | |
def main(): | |
url = input("cURL Link: ") | |
filename = input("Filename: ") | |
print("Select a number.") | |
downloads_path = str(Path.home() / "Downloads") | |
music_path = str(Path.home() / "Music") | |
print("[1] Downloads\n[2] Music") | |
try: | |
choice = input("Choice: ") | |
choice = int(choice) | |
except ValueError as e: | |
print("Invalid input!") | |
return e | |
if choice == 1: | |
curl(url, filename, downloads_path) | |
elif choice == 2: | |
curl(url, filename, music_path) | |
else: | |
print("Failed to get a proper answer.") | |
return "" | |
if __name__ == "__main__": | |
case = main() | |
if case: # fuck up somewhere where we return an actual string | |
print(case) | |
system("pause") | |
else: | |
print("Finished running program, enjoy your results.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment