diff --git a/.gitignore b/.gitignore index ba72f0c..5ba9d18 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,6 @@ src/ *.txt !requirements.txt -# Settings file -settings.json - # Comma-Separated Values (CSV) Reports *.csv diff --git a/archiver.py b/archiver.py index 71e53e3..9b2dbbb 100644 --- a/archiver.py +++ b/archiver.py @@ -113,7 +113,7 @@ def archiver(yt_urls:list,output_directory:str="downloaded"): input("\nMega.io login credentials not found. Please enter them in settings.json") remove_output_folder(output_directory) - + print("\nDownloading videos...") # Extract yt urls from playlists and channels @@ -160,8 +160,6 @@ def archiver(yt_urls:list,output_directory:str="downloaded"): if __name__ == '__main__': yt_urls = input_youtube_links() - #yt_urls = ["https://www.youtube.com/watch?v=-FShtfB--pQ","https://www.youtube.com/watch?v=LK6KVBnmWpU&list=PL8SZ21Qv2Fenl6Y7d0AqxJpKEf630g7HA&index=1"] - archiver(yt_urls) print("\nCompleted..") \ No newline at end of file diff --git a/archiver_packages/mega.py b/archiver_packages/mega.py index 35a1ffc..387e2b4 100644 --- a/archiver_packages/mega.py +++ b/archiver_packages/mega.py @@ -14,7 +14,7 @@ def mega_upload(driver:webdriver.Chrome,login:str,password:str,delay:int,files:l driver.get("https://mega.nz/login") longwait=WebDriverWait(driver, 60*2) # For longer waits - try: + try: longwait.until(EC.element_to_be_clickable((By.ID, "login-name2"))) driver.find_element(By.ID, "login-name2").send_keys(login) diff --git a/archiver_packages/scrape_youtube.py b/archiver_packages/scrape_youtube.py index cc23cf1..c9243f9 100644 --- a/archiver_packages/scrape_youtube.py +++ b/archiver_packages/scrape_youtube.py @@ -39,6 +39,18 @@ def parse_comment_text(driver:webdriver.Chrome,element:WebElement) -> str: return text +def style_reply_mention(input_text:str) -> str: + if input_text.strip().startswith('@'): + + # Extract the first word + first_word, remaining_text = input_text.split(' ', 1) + + # Apply style to the mention + input_text = f'{first_word} {remaining_text}' + + return input_text + + def parse_comments(html:HTMLParser): like_count = html.css_first("[id='vote-count-middle']").text() @@ -155,6 +167,7 @@ def add_comments(driver:webdriver.Chrome,profile_image:str,output,delay:int): driver.execute_script("arguments[0].scrollIntoView();", reply) # Slow scroll replies text = parse_comment_text(driver,reply) + text = style_reply_mention(text) html_reply = HTMLParser(reply.get_attribute("innerHTML")) like_count,channel_username,comment_date,channel_url,channel_pfp = parse_comments(html_reply) @@ -163,7 +176,7 @@ def add_comments(driver:webdriver.Chrome,profile_image:str,output,delay:int): heart = html_reply.css_first('#creator-heart-button') if heart: heart = htmls.heart(profile_image) - else: + else: heart = "" # Add reply diff --git a/settings.json b/settings.json index c31ef05..3326466 100644 --- a/settings.json +++ b/settings.json @@ -8,6 +8,6 @@ }, "extra": { "delay": 1, - "headless": false + "headless": true } } \ No newline at end of file