Skip to content

Instantly share code, notes, and snippets.

@Priler
Created July 22, 2021 09:45
Show Gist options
  • Save Priler/3dab2608a345b5d11bfed78f600bfa0a to your computer and use it in GitHub Desktop.
Save Priler/3dab2608a345b5d11bfed78f600bfa0a to your computer and use it in GitHub Desktop.
Video download from YouTube with youtube-dl
from __future__ import unicode_literals
import youtube_dl
def progress_hook(d):
if(d['status'] == "downloading"):
print(f'{d["_speed_str"]} ({d["_percent_str"]})')
else:
print("Готово!")
ydl_opts = {
'progress_hooks': [progress_hook]
}
link = input("Введите ссылку на видос: ")
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([link])
@nodir-malikov
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment