Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Nov 29, 2024
1 parent 7cc6c09 commit 43b8d1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion objects/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,18 @@ def download_video(yt, folder):
if video_stream is None:
print("No streams available to download.")
return
print(f"Selected video stream: {video_stream}")
video_path = os.path.join(folder, "video.mp4")
yt.register_on_progress_callback(lambda stream, chunk, bytes_remaining: save_progress(stream, bytes_remaining, folder))
yt.register_on_progress_callback(
lambda stream, chunk, bytes_remaining: save_progress(stream, bytes_remaining, folder)
)
video_stream.download(output_path=folder, filename="video.mp4")
print(f"Video downloaded successfully to '{video_path}'.")
except Exception as e:
print(f"Error downloading video: {e}")
import traceback
traceback.print_exc()



def main():
Expand Down

0 comments on commit 43b8d1e

Please sign in to comment.