✌️ Title and Tags

pull/632/head
CoasterFreakDE 3 years ago
parent 5aaac48d07
commit fcafb40656
No known key found for this signature in database
GPG Key ID: 05AC02A2DB97BC3A

@ -39,6 +39,7 @@ password = getenv("REDDIT_PASSWORD")
reddit2fa = getenv("REDDIT_2FA")
tiktok_email = getenv("TIKTOK_EMAIL")
tiktok_password = getenv("TIKTOK_PASSWORD")
tiktok_tags = getenv("TIKTOK_TAGS")
def main():
@ -49,12 +50,13 @@ def main():
reddit_obj = get_subreddit_threads()
return reddit_obj
reddit_object = get_obj()
length, number_of_comments = save_text_to_mp3(reddit_object)
download_screenshots_of_reddit_posts(reddit_object, number_of_comments)
download_background()
chop_background_video(length)
video_file_name = make_final_video(number_of_comments, length)
# reddit_object = get_obj()
# length, number_of_comments = save_text_to_mp3(reddit_object)
# download_screenshots_of_reddit_posts(reddit_object, number_of_comments)
# download_background()
# chop_background_video(length)
# video_file_name = make_final_video(number_of_comments, length)
video_file_name = "Whats something people in this....mp4"
loop = asyncio.get_event_loop()
loop.run_until_complete(upload_video_to_tiktok(video_file_name))
loop.close()

@ -54,5 +54,12 @@
"background_credit": "loopylongplays",
"reddit_title": "How does someone politely end a conversation with a person who wont stop talking",
"filename": "How does someone politely end ....mp4"
},
{
"id": "vgo3dv",
"time": "1655749966",
"background_credit": "bbswitzer",
"reddit_title": "Whats something people in this generation really need to hear",
"filename": "Whats something people in this....mp4"
}
]

@ -1,6 +1,6 @@
from asyncio import sleep
import asyncio
import json
import imp
from os import getenv
import os
from pathlib import Path
@ -9,14 +9,13 @@ import pickle
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import selenium.common
from selenium.webdriver.common.keys import Keys
from playwright.async_api import async_playwright
import undetected_chromedriver.v2 as uc
from fake_useragent import UserAgent, FakeUserAgentError
from fake_useragent import UserAgent
from utils.console import print_step, print_substep
import json
from rich.console import Console
console = Console()
@ -70,6 +69,27 @@ async def upload_video_to_tiktok(videofile):
browser.find_elements(By.XPATH, '//*[@id="root"]/div/div/div/div/div[2]/div[1]/div/input')[0].send_keys(abs_path)
print_substep("Uploading video...")
await asyncio.sleep(10)
title = os.getenv("VIDEO_TITLE") or videofile.split(".")[0]
tags = os.getenv("TIKTOK_TAGS") or "#AskReddit"
if len(title) + len(tags) > 150:
if len(tags) > 150:
print_substep("Tags are too long, please shorten them.")
return
remove = 149 - len(tags)
title = title[:remove] + " " + tags
else:
title = title + " " + tags
title_input = browser.find_elements(By.XPATH, '//*[@id="root"]/div/div/div/div/div[2]/div[2]/div[1]/div/div[1]/div[2]/div/div[1]/div/div/div/div/div/div')[0]
title_input.send_keys(Keys.CONTROL, "a")
title_input.send_keys(Keys.BACKSPACE)
title_input.send_keys(title)
await asyncio.sleep(1)
browser.find_elements(By.XPATH, '//*[@id="root"]/div/div/div/div/div[2]/div[2]/div[7]/div[2]/button')[0].click()
await asyncio.sleep(5)

Loading…
Cancel
Save