Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Jul 11, 2024
1 parent 331bd56 commit a236e3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ytdl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def download_yt_song(id: str) -> int:
YouTube("https://www.youtube.com/watch?v=" + id) \
.streams.filter(only_audio=True).first() \
.download(output_path=DOWNLOAD_PATH, filename=id + ".mp3")
except pytube_exceptions.AgeRestrictedError:
except Exception:
try:
print(f"song with id {id} is age resticted, trying yt_dlp...")
ytdl = YoutubeDL({
Expand Down Expand Up @@ -193,10 +193,10 @@ def download_song(song_yt_id: str) -> int:
currently_downloading_queue.add(song_yt_id)
res = download_yt_song(song_yt_id)
currently_downloading_queue.remove(song_yt_id)
update_song_status(song_yt_id)
if res != 0:
print(f"error: {YT_ERROR[res]} when downloading {song_yt_id}")
return res
update_song_status(song_yt_id)
print("Successfully downloaded " + song_yt_id)
return 0
return 3
Expand Down

0 comments on commit a236e3a

Please sign in to comment.