mirror of
https://github.com/anatolykopyl/youtube-cdl.git
synced 2026-03-26 12:55:11 +00:00
♻️ Graceful exit
This commit is contained in:
10
main.py
10
main.py
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user