ytubePublished by onesixx on 23-01-3123-01-31 Python import argparse import os import pytube # pip install git+https://github.com/baxterisme/pytube parser = argparse.ArgumentParser(description="Download youtube for data gathering") parser.add_argument("-u", "--url", help="URL of youtube") # required=True, args = parser.parse_args() # for debug # MyURL = 'https://youtu.be/Jq4--rtLBPs' # args = argparse.Namespace(url=MyURL) streamList = pytube.YouTube(args.url).streams result_stream = [] myResList=["720p", "1080p", "1440p", "2160p"] for stream in streamList: if 'video/mp4' in str(stream): if 'acodec' in str(stream): if any( myRes in str(stream) for myRes in myResList): result_stream.append(stream) if len(result_stream) < 1 : print("NOT Found") elif len(result_stream) >1 : print("22222222") for idx, stream in enumerate(result_stream): print(f" {idx} :: {stream}") s = input('press number key to select video index : ') result_stream[int(s)].download() else: print("1111") print(result_stream) result_stream[0].download() print("end") Categories: Tool-SW onesixx Blog Owner Label {} [+] Name* Email Δ Label {} [+] Name* Email Δ 0 Comments Inline Feedbacks View all comments