Call your progress function inside the Youtube class
yt = YouTube(video_link, on_progress_callback=progress_function)
This is your progress function
def progress_function(self,stream, chunk,file_handle, bytes_remaining):
size = stream.filesize
p = 0
while p <= 100:
progress = p
print str(p)+'%'
p = percent(bytes_remaining, size)
This computes the percentage converting the file size and the bytes remaining
def percent(self, tem, total):
perc = (float(tem) / float(total)) * float(100)
return perc
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…