Skip to content

Commit

Permalink
Return list of failed links if could not download due to several issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBocch committed Jan 30, 2024
1 parent a9945c0 commit ab2ed05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def getLinks(text):

def download(links):
os.chdir("ytb2mp3_music")
failed = []
for link in links:
try:
yt = YouTube(link)
Expand All @@ -21,7 +22,9 @@ def download(links):
try:
yt.streams.get_audio_only().download()
except:
failed.append(link)
print("by pass age restricted videos somehow")
return failed

renameAlltoMp3()
os.chdir("..")
Expand Down
8 changes: 7 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ def download_button():
down_button.state(['disabled'])
links = parseText()
setup()
download(links)
failed = download(links)

text.delete("1.0", "9999999999999999.0")
text.insert("1.0", f"failed to download\n")
for f in failed:
text.insert("2.0", f"{f}\n")

down_button.state(['!disabled'])


Expand Down

0 comments on commit ab2ed05

Please sign in to comment.