mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Respect --limit when downloading clips
This commit is contained in:
parent
63c2aff334
commit
5bd0747dde
@ -63,18 +63,25 @@ def _clip_target_filename(clip):
|
||||
|
||||
|
||||
def _clips_download(args):
|
||||
downloaded_count = 0
|
||||
generator = twitch.channel_clips_generator(args.channel_name, args.period, 100)
|
||||
|
||||
for clips, _ in generator:
|
||||
for clip in clips["edges"]:
|
||||
clip = clip["node"]
|
||||
url = clip["videoQualities"][0]["sourceURL"]
|
||||
target = _clip_target_filename(clip)
|
||||
|
||||
if path.exists(target):
|
||||
print_out("Already downloaded: <green>{}</green>".format(target))
|
||||
else:
|
||||
print_out("Downloading: <yellow>{}</yellow>".format(target))
|
||||
download_file(url, target)
|
||||
|
||||
downloaded_count += 1
|
||||
if args.limit and downloaded_count >= args.limit:
|
||||
return
|
||||
|
||||
|
||||
def clips(args):
|
||||
if args.json:
|
||||
|
Loading…
Reference in New Issue
Block a user