0

I want to create a script which will download videos using yt-dlp, and show it beatifully in console.

c = Console()
with c.status("[bold blue]Downloading video...", spinner='bounce') as status:
        with yt_dlp.YoutubeDL(ydl_opts) as ydl:
            info_dict = ydl.extract_info(link, download=True)
            downloaded_file_path = ydl.prepare_filename(info_dict)
c.print(f"[bold green]Video [i u blue]{downloaded_file_path}[/i u blue] downloaded![/bold green]")

I expected to have output like this: (don't mind that video, i just used it for test)

⠂ Downloading video... #this will be updating while download and deletes after video downloaded
[TikTok] Extracting URL: https://www.tiktok.com/@mmeowmmia/video/7202978058284846341?is_from_webapp=1&sender_device=pc
[TikTok] 7202978058284846341: Downloading video feed
[info] 7202978058284846341: Downloading 1 format(s): bytevc1_720p_472959-2
Deleting existing file videos\test.mp4
[download] Destination: videos\test.mp4
[download] 100% of    3.36MiB in 00:00:00 at 6.92MiB/s
Video videos\test.mp4 downloaded!

but instead, i get this

⠂ Downloading video...[TikTok] Extracting URL: https://www.tiktok.com/@mmeowmmia/video/7202978058284846341?is_from_webapp=1&sender_device=pc
[TikTok] 7202978058284846341: Downloading video feed
⠄ Downloading video...[info] 7202978058284846341: Downloading 1 format(s): bytevc1_720p_472959-2
Deleting existing file videos\test.mp4
⠁ Downloading video...[download] Destination: videos\test.mp4
[download] 100% of    3.36MiB in 00:00:00 at 6.92MiB/s
Video videos\test.mp4 downloaded!

So, it is duplicated several types! Also, is there a way to delete status from console after downloading the video?

0 Answers0