From 7c6ebc8d51d68cb0f26efdd76926ad3d72027b7f Mon Sep 17 00:00:00 2001 From: Kim Oliver Drechsel Date: Fri, 17 Sep 2021 00:23:35 +0200 Subject: [PATCH] add prnt.sc link generator.py Add a url generator to search randomly through the uploaded images on prnt.sc Signed-off-by: Kim Oliver Drechsel --- prnt.sc link generator.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 prnt.sc link generator.py diff --git a/prnt.sc link generator.py b/prnt.sc link generator.py new file mode 100644 index 0000000..c4c3ec9 --- /dev/null +++ b/prnt.sc link generator.py @@ -0,0 +1,34 @@ +import random +import string +import webbrowser + +""" +prnt.sc is a web frontend for a third-party screenshot software +that automatically uploads the users screenshot and returns a url to the image to the clipboard +so that users can share their screenshot via the url with other people + +This is a url generator that takes advantage of the url scheme to search randomly through the uploaded images +""" + +NUMBER_OF_LINKS_TO_GENERATE = 5 # generates X urls at a time +URL_AUTO_OPEN = True # Open the URL automatically in your Browser +CLOSE_WINDOW_AFTER = True # Closes window at Script end (keep open to see/copy the original url) + +############## + + +def generate_url(base_url: str = 'https://prnt.sc/'): + random_chars = ''.join(random.choice(string.ascii_lowercase) for _ in range(2)) + random_digits = ''.join(random.choice(string.digits) for _ in range(4)) + + return f"{base_url}{random_chars}{random_digits}" + + +for _ in range(NUMBER_OF_LINKS_TO_GENERATE): + URL = generate_url() + print(URL) + if URL_AUTO_OPEN is True: + webbrowser.open(URL) + +if CLOSE_WINDOW_AFTER: + input('\nPress Enter to Exit...')