♻️ Graceful exit

This commit is contained in:
2021-04-12 23:47:25 +03:00
parent a1df43f83a
commit 9db691ee26

10
main.py
View File

@@ -120,5 +120,11 @@ for ch in all_channels:
with youtube_dl.YoutubeDL(ydl_opts) as ydl: with youtube_dl.YoutubeDL(ydl_opts) as ydl:
Path(os.path.join(output_dir, ch['title'])).mkdir( Path(os.path.join(output_dir, ch['title'])).mkdir(
parents=True, exist_ok=True) parents=True, exist_ok=True)
ydl.download( try:
['https://www.youtube.com/channel/{}'.format(ch["id"])]) ydl.download(
['https://www.youtube.com/channel/{}'.format(ch["id"])])
except KeyboardInterrupt:
c.print('\nGoodbye!', style='orange1')
c.print(
'Start where you left off with "python main.py -i download_list.json"')
sys.exit()