Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ZG4RBU committed Nov 30, 2023
1 parent c0f9986 commit 31fe6ae
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ src/
*.txt
!requirements.txt

# Settings file
settings.json

# Comma-Separated Values (CSV) Reports
*.csv

Expand Down
4 changes: 1 addition & 3 deletions archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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..")
2 changes: 1 addition & 1 deletion archiver_packages/mega.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 14 additions & 1 deletion archiver_packages/scrape_youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<span style="color: #3EA6FF;">{first_word}</span> {remaining_text}'

return input_text


def parse_comments(html:HTMLParser):

like_count = html.css_first("[id='vote-count-middle']").text()
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
},
"extra": {
"delay": 1,
"headless": false
"headless": true
}
}

0 comments on commit 31fe6ae

Please sign in to comment.