Skip to content
Advertisement

Downloading YouTube videoes with pafy module with tqdm progressbar

I am trying to make a code to download videos from YouTube using pafy module and a progressbar using tqdm module, however the progressbar is finished before the download complete.

here is my code download piece:

JavaScript

here is a pic a the progressbar:

https://i.stack.imgur.com/VMBUN.png

Advertisement

Answer

Problem is because pbar.update() expects value current_received - previous_received

download gives only current_received so you have to use some variable to rember previous value and substract it


Minimal working code:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement