From 47e5aa3503e5a703d9d0fc7c19b58a01df0d5fcf Mon Sep 17 00:00:00 2001 From: evilwumpus Date: Tue, 6 Jun 2023 02:10:40 -0500 Subject: [PATCH] added colored title --- functions.py | 18 ++++++++++++++++-- main.py | 4 +++- requirements.txt | 3 ++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/functions.py b/functions.py index e02eb2e..1d84d5d 100644 --- a/functions.py +++ b/functions.py @@ -1,6 +1,7 @@ import sys import time import os +from termcolor import colored import undetected_chromedriver as uc from py_imessage import imessage from selenium.webdriver.support.wait import WebDriverWait @@ -44,14 +45,14 @@ def loop_twitter_page(driver: uc.Chrome, TWEET_XPATH: str, last_tweet: str) -> s resp, code_found = clean_text(tweet_element.text) if code_found: - print(f"Code found at {get_current_time()}") + print(f"Code found at {get_current_time()} ({resp})") return resp else: print(resp) def countdown(i = 25): for _ in range(i): - print(f"Restarting in {i} seconds, CTRL + V to cancel ", end='\r') + print(f"Restarting in {i} seconds, CTRL + C to cancel ", end='\r') sys.stdout.flush() i -= 1 time.sleep(1) @@ -60,3 +61,16 @@ def countdown(i = 25): def send_text(code: str) -> str: imessage.send("888222", code) return f"Text sent at {get_current_time()}! ({code})\nPlease check your phone" + +def title(): + title_ascii = ''' + ____ _ _ _ _ _____ ____ + / ___| |__ (_)_ __ ___ | |_| | ___ | ___| _ \ + | | | '_ \| | '_ \ / _ \| __| |/ _ \ | |_ | |_) | + | |___| | | | | |_) | (_) | |_| | __/ | _| | __/ + \____|_| |_|_| .__/ \___/ \__|_|\___| |_| |_| + |_| + +https://github.com/EvilWumpus +''' + print(colored(title_ascii, "green")) \ No newline at end of file diff --git a/main.py b/main.py index 0e5f80f..e61ca0f 100644 --- a/main.py +++ b/main.py @@ -1,17 +1,19 @@ import os -from functions import get_latest_tweet, loop_twitter_page, send_text, countdown +from functions import get_latest_tweet, loop_twitter_page, send_text, countdown, title import undetected_chromedriver as uc if __name__ == "__main__": TWEET_XPATH = '/html/body/div[1]/div/div/div[2]/main/div/div/div/div[1]/div/div[3]/div/div/section/div/div/div[1]/div/div/article/div/div/div[2]/div[2]/div[2]/div/span' while True: + title() print("Starting...") driver = uc.Chrome(headless=True) driver.get("https://twitter.com/ChipotleTweets") latest_tweet = get_latest_tweet(driver, TWEET_XPATH) os.system("clear") + title() code = loop_twitter_page(driver, TWEET_XPATH, latest_tweet) resp = send_text(code) driver.quit() diff --git a/requirements.txt b/requirements.txt index ac8a182..094e763 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ undetected_chromedriver py_imessage -selenium \ No newline at end of file +selenium +termcolor \ No newline at end of file