@@ -0,0 +1,1626 @@
+import argparse%0A%0Afrom .api import YouTube%0Afrom .utils import print_status%0A%0A%0Adef _main():%0A    parser = argparse.ArgumentParser(description='YouTube video downloader')%0A    parser.add_argument(%22url%22, help=%22The URL of the Video to be downloaded%22)%0A    parser.add_argument(%22--extension%22, %22-e%22,%0A                        help=%22The requested format of the video%22, dest=%22ext%22)%0A    parser.add_argument(%22--resolution%22, %22-r%22,%0A                        help=%22The requested resolution%22, dest=%22res%22)%0A    parser.add_argument(%22--path%22, %22-p%22,%0A                        help=%22The path to save the video to.%22, dest=%22path%22)%0A    parser.add_argument(%22--filename%22, %22-f%22,%0A                        dest=%22filename%22,%0A                        help=(%22The filename, without extension, %22%0A                              %22to save the video in.%22))%0A%0A    args = parser.parse_args()%0A%0A    yt =  YouTube()%0A    yt.url = args.url%0A%0A    if args.filename:%0A        yt.filename = args.filename%0A%0A    if args.ext and args.res:%0A        # There's only ope video that matches both so get it%0A        vid = yt.get(args.ext, args.res)%0A    elif args.ext:%0A        # There are several videos with the same extension%0A        videos = yt.filter(extension=args.ext)%0A        # Select the highest resolution one%0A        vid = max(videos)%0A    elif args.res:%0A        # There are several videos with the same extension%0A        videos = yt.filter(resolution=args.res)%0A        # Select the highest resolution one%0A        vid = max(videos)%0A    else:%0A        # If nothing is specified get the highest resolution one%0A        vid = max(yt.videos)%0A%0A    vid.download(path=args.path, on_progress=print_status)%0A

Add a command line tool.