Anna Geller
Chris Reuter
05/26/2022, 7:03 PMloris
05/31/2022, 8:08 PMAnna Geller
Anna Geller
ale
06/08/2022, 7:29 AMChris Reuter
06/08/2022, 10:13 PMChris Reuter
06/09/2022, 1:00 PMChris Reuter
06/10/2022, 5:56 PMSlackbot
06/12/2022, 8:41 AMSimon SpΓ€ti
06/14/2022, 5:41 PMKhuyen Tran
07/06/2022, 3:28 PMKevin Focke
07/10/2022, 2:38 PMJoshua Greenhalgh
07/11/2022, 5:28 PMOliver Mannion
07/12/2022, 10:27 AMSlackbot
07/19/2022, 2:25 PMKhuyen Tran
07/20/2022, 10:49 PMAnna Geller
Valeria Romero
07/25/2022, 7:11 PMAnna Geller
Benny Warlick
07/31/2022, 1:21 AMCA Lee
07/31/2022, 5:02 AMKhuyen Tran
07/31/2022, 4:50 PMChris Reuter
07/31/2022, 5:35 PMAndreas
08/01/2022, 2:35 PM#!/usr/bin/env python
import argparse
from pytube import Playlist, YouTube
from prefect import task, flow
from pydantic import HttpUrl
from prefect_dask import DaskTaskRunner
@task(retries=3, retry_delay_seconds=4)
def download_video(video: YouTube):
video.streams.get_highest_resolution().download()
return
@flow(task_runner=DaskTaskRunner)
def playlist_downloader(playlist_url: HttpUrl):
p = Playlist(playlist_url)
for video in p.videos:
download_video.submit(video)
return
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Downloads all youtubes videos in a playlist in parallel using the highest available resolution')
parser.add_argument('playlist', help='a playlist url to download videos')
args = parser.parse_args()
playlist_downloader(args.playlist)
It is really great that using Prefect we are able to orchestrate this functionality in so few lines of code and use features like running stuff in parallel using Dask and having retry functionality prefect duck