From 01b9bd121038458641449bfebda0fb117628aab2 Mon Sep 17 00:00:00 2001 From: voletro <65332602+voletro@users.noreply.github.com> Date: Tue, 10 Aug 2021 17:35:12 +1000 Subject: [PATCH] Update main.py Added 75 character description limit to allow for YouTube's 100 character Title limit. --- main.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index b0b03a2..c018cf1 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ ██║ ██║██║ ██╗ ██║ ╚██████╔╝██║ ██╗ ██║ ╚██████╔╝ ██║ ██║ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ -By jakenic +By voletro Downloads a trending TikTok video and uploads it to YouTube. This will happen every half an hour (30 mins). @@ -184,17 +184,15 @@ def _set_endcard(driver: WebDriver): def _set_time(driver: WebDriver): # Start time scheduling WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.NAME, "PUBLIC"))).click() + WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "step-badge-2"))).click() + WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.ID, "results-description"))) + copyrightinfo: WebElement = driver.find_element_by_id("results-description") + if "Copyright claim found." in copyrightinfo.text: + driver.close() + else: + print("test") def main(): - title = """ -████████╗██╗██╗ ██╗████████╗ ██████╗ ██╗ ██╗ ████████╗ ██████╗ ██╗ ██╗████████╗ -╚══██╔══╝██║██║ ██╔╝╚══██╔══╝██╔═══██╗██║ ██╔╝ ╚══██╔══╝██╔═══██╗ ╚██╗ ██╔╝╚══██╔══╝ - ██║ ██║█████╔╝ ██║ ██║ ██║█████╔╝ ██║ ██║ ██║ ╚████╔╝ ██║ - ██║ ██║██╔═██╗ ██║ ██║ ██║██╔═██╗ ██║ ██║ ██║ ╚██╔╝ ██║ - ██║ ██║██║ ██╗ ██║ ╚██████╔╝██║ ██╗ ██║ ╚██████╔╝ ██║ ██║ - ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - """ - print(title) api = TikTokApi.get_instance() trending = api.trending(count=1, custom_verifyFp="") for tiktok in trending: @@ -206,6 +204,8 @@ def main(): desc = tiktok['desc'] print("Downloading video...") urllib.request.urlretrieve(link, f'{username}-{id}.mp4') + if len(desc) > 75: + desc = desc[:75] title = f"{desc} - @{username} - For You" description = f"Credit to the original creator, @{username}. Check out their other content here: https://tiktok.com/@{username}" print("Downloaded video!") @@ -244,9 +244,20 @@ def main(): driver.close() raise + +os.system('cls' if os.name in ('nt', 'dos') else 'clear') +texttitle = """ +████████╗██╗██╗ ██╗████████╗ ██████╗ ██╗ ██╗ ████████╗ ██████╗ ██╗ ██╗████████╗ +╚══██╔══╝██║██║ ██╔╝╚══██╔══╝██╔═══██╗██║ ██╔╝ ╚══██╔══╝██╔═══██╗ ╚██╗ ██╔╝╚══██╔══╝ + ██║ ██║█████╔╝ ██║ ██║ ██║█████╔╝ ██║ ██║ ██║ ╚████╔╝ ██║ + ██║ ██║██╔═██╗ ██║ ██║ ██║██╔═██╗ ██║ ██║ ██║ ╚██╔╝ ██║ + ██║ ██║██║ ██╗ ██║ ╚██████╔╝██║ ██╗ ██║ ╚██████╔╝ ██║ ██║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ +""" +print(texttitle) while True: - os.system('cls' if os.name in ('nt', 'dos') else 'clear') main() print("Finished upload.") print("Waiting for next upload.") - sleep(1800) \ No newline at end of file + sleep(1800) +