Skip to content

Commit

Permalink
added colored title
Browse files Browse the repository at this point in the history
  • Loading branch information
llambert721 committed Jun 6, 2023
1 parent 645babd commit 47e5aa3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
18 changes: 16 additions & 2 deletions functions.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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"))
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
undetected_chromedriver
py_imessage
selenium
selenium
termcolor

0 comments on commit 47e5aa3

Please sign in to comment.