def _download_clip(slug, args): print_out("<dim>Looking up clip...</dim>") clip = twitch.get_clip(slug) if not clip: raise ConsoleError("Clip '{}' not found".format(slug)) print_out( "Found: <green>{}</green> by <yellow>{}</yellow>, playing <blue>{}</blue> ({})" .format(clip["title"], clip["broadcaster"]["displayName"], clip["game"]["name"], utils.format_duration(clip["durationSeconds"]))) url = _get_clip_url(clip, args) print_out("<dim>Selected URL: {}</dim>".format(url)) url_path = urlparse(url).path extension = Path(url_path).suffix filename = "{}_{}{}".format(clip["broadcaster"]["login"], utils.slugify(clip["title"]), extension) print_out("Downloading clip...") download_file(url, filename) print_out("Downloaded: {}".format(filename))
def _download_clip(slug, args): print_out("<dim>Looking up clip...</dim>") clip = twitch.get_clip(slug) print_out("Found: <green>{}</green> by <yellow>{}</yellow>, playing <blue>{}</blue> ({})".format( clip["title"], clip["broadcaster"]["displayName"], clip["game"]["name"], utils.format_duration(clip["durationSeconds"]) )) print_out("\nAvailable qualities:") qualities = clip["videoQualities"] for n, q in enumerate(qualities): print_out("{}) {} [{} fps]".format(n + 1, q["quality"], q["frameRate"])) no = utils.read_int("Choose quality", min=1, max=len(qualities), default=1) selected_quality = qualities[no - 1] url = selected_quality["sourceURL"] url_path = urlparse(url).path extension = Path(url_path).suffix filename = "{}_{}{}".format( clip["broadcaster"]["login"], utils.slugify(clip["title"]), extension ) print("Downloading clip...") download_file(url, filename) print("Downloaded: {}".format(filename))
def _download_clip(slug, args): print_out("<dim>Looking up clip...</dim>") clip = twitch.get_clip(slug) if not clip: raise ConsoleError("Clip '{}' not found".format(slug)) print_out( "Found: <green>{}</green> by <yellow>{}</yellow>, playing <blue>{}</blue> ({})" .format(clip["title"], clip["broadcaster"]["displayName"], clip["game"]["name"], utils.format_duration(clip["durationSeconds"]))) target = _clip_target_filename(clip, args) print_out("Target: <blue>{}</blue>".format(target)) if not args.overwrite and path.exists(target): response = input("File exists. Overwrite? [Y/n]: ") if response.lower().strip() not in ["", "y"]: raise ConsoleError("Aborted") args.overwrite = True url = get_clip_authenticated_url(slug, args.quality) print_out("<dim>Selected URL: {}</dim>".format(url)) print_out("<dim>Downloading clip...</dim>") download_file(url, target) print_out("Downloaded: <blue>{}</blue>".format(target))
def _clips_download(args): 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)
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 = get_clip_authenticated_url(clip["slug"], "source") 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 _download_clip(slug, args): print_out("<dim>Looking up clip...</dim>") clip = twitch.get_clip(slug) if not clip: raise ConsoleError("Clip '{}' not found".format(slug)) print_out( "Found: <green>{}</green> by <yellow>{}</yellow>, playing <blue>{}</blue> ({})" .format(clip["title"], clip["broadcaster"]["displayName"], clip["game"]["name"], utils.format_duration(clip["durationSeconds"]))) url = _get_clip_url(clip, args) print_out("<dim>Selected URL: {}</dim>".format(url)) target = _clip_target_filename(clip) print_out("Downloading clip...") download_file(url, target) print_out("Downloaded: {}".format(target))