'pytube video download: inconsistent on_progress_callback
I am using pytube to download some videos and would like to display a progress message during the process. I do understand the code to do that, here is what I have:
from pytube import YouTube
def on_progress(stream, chunk, bytes_remaining):
print('download progress')
video_object = YouTube('video link here', on_progress_callback = on_progress)
video_object.streams.get_highest_resolution().download()
My problem is that on_progress is called at seemingly inconsistent frequencies. I tested several 3 minute videos, sometimes on_progress was called 10 times during the download and other times it was called 3 times. I also tested downloading different quality streams and the message still appeared the same number of times.
So, the number of times on_progress was consistent for each individual video (when downloading the same video on_progress was called with the same frequency every time) but when I test different videos it seems to fluctuate massively how often it is called and video quality does not seem to cause this.
Is there any information on this? Is this a youtube issue that cannot be controlled for?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
