Package: youtube.py
YouTube PythonYoutube Python is best and powerful python module for developers internal use APIs or command line CLI , Downloading specific video or playlist if now easy.InstallPython modulerun this command on terminal.$ pip install -U youtube.pyHave multipls versions of python?$ python3.x -m pip install -U youtube.pyInstall FFMPEGWindows downloadlink. After download the exe file make sure to put that on environment variables or simply moveffmpeg.exetoc:\windows\system32\For Linux$ sudo apt update
$ sudo apt install ffmpegFeaturesSupports proxy (for scraping data, proxy will not be used for downloading videos)Rate limit bypassLight moduleCommand line input availableSupports FFMPEGCan parsec youtube video detailsYoutube Search, Video, PlayListBasicfromyoutubeimportVideovideo_url="https://www.youtube.com/watch?v=3AtDnEC4zak"v=Video(video_url)#Print Titleprint(v.title)#Print Author nameprint(v.author)#Print Channel IDprint(v.channel)#Print video descriptionprint(v.description)#Print video length in secondprint(v.length)#Print video keywords in dictprint(v.keywords)#Print high resolution thumbnailprint(v.thumbnail)#Print video idprint(v.videoId)#Print total video viewsprint(v.views)Working with streams>>>fromyoutubeimportVideo>>>v=Video("https://www.youtube.com/watch?v=3AtDnEC4zak")>>>v.title"Charlie Puth - We Don't Talk Anymore (feat. Selena Gomez) [Official Video]">>>v.length231>>>v.views2550001850>>>v.streams[<ClassStream:itag="18"qualityLabel="360p"fps="24"mime="video/mp4"type="both"format="mp4"codecs="avc1.42001E,+mp4a.40.2">,<ClassStream:itag="133"qualityLabel="240p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="avc1.4d4015">,<ClassStream:itag="134"qualityLabel="360p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="avc1.4d401e">,<ClassStream:itag="135"qualityLabel="480p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="avc1.4d401e">,<ClassStream:itag="136"qualityLabel="720p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="avc1.4d401f">,<ClassStream:itag="137"qualityLabel="1080p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="avc1.640028">,<ClassStream:itag="160"qualityLabel="144p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="avc1.4d400c">,<ClassStream:itag="242"qualityLabel="240p"fps="24"mime="video/webm"type="video"format="webm"codecs="vp9">,<ClassStream:itag="243"qualityLabel="360p"fps="24"mime="video/webm"type="video"format="webm"codecs="vp9">,<ClassStream:itag="244"qualityLabel="480p"fps="24"mime="video/webm"type="video"format="webm"codecs="vp9">,<ClassStream:itag="247"qualityLabel="720p"fps="24"mime="video/webm"type="video"format="webm"codecs="vp9">,<ClassStream:itag="248"qualityLabel="1080p"fps="24"mime="video/webm"type="video"format="webm"codecs="vp9">,<ClassStream:itag="249"bitrate="59056"mime="audio/webm"type="audio"format="webm"codecs="opus">,<ClassStream:itag="250"bitrate="76035"mime="audio/webm"type="audio"format="webm"codecs="opus">,<ClassStream:itag="251"bitrate="143852"mime="audio/webm"type="audio"format="webm"codecs="opus">,<ClassStream:itag="278"qualityLabel="144p"fps="24"mime="video/webm"type="video"format="webm"codecs="vp9">,<ClassStream:itag="394"qualityLabel="144p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="av01.0.00M.08">,<ClassStream:itag="395"qualityLabel="240p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="av01.0.00M.08">,<ClassStream:itag="396"qualityLabel="360p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="av01.0.01M.08">,<ClassStream:itag="397"qualityLabel="480p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="av01.0.04M.08">,<ClassStream:itag="398"qualityLabel="720p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="av01.0.05M.08">,<ClassStream:itag="399"qualityLabel="1080p"fps="24"mime="video/mp4"type="video"format="mp4"codecs="av01.0.08M.08">]>>>type(v.streams)<class'youtube.Stream.Queue'>>>>v.thumbnail'https://i.ytimg.com/vi/3AtDnEC4zak/maxresdefault.jpg'>>>v.get_dict[{'itag':18,'mimeType':'video/mp4','bitrate':395026,'width':640,'height':360,'lastModified':'1580859977121104','contentLength':'11378647','quality':'medium','fps':24,'qualityLabel':'360p','projectionType':'RECTANGULAR','averageBitrate':394913,'audioQuality':'AUDIO_QUALITY_LOW','approxDurationMs':'230504','audioSampleRate':'44100','audioChannels':2,'type':'both','format':'mp4','codecs':'avc1.42001E,+mp4a.40.2','s':'mAq0QJ8wRQIgRe0DKBgGi4uiqHOk6dmrhwQKtFCcrhCKAvNHps-hzk0CIQDDW_HSmfLlD3-4G5x3XtamqDtAWRVkjYYGv_qFYUY4Ow====','sp':'sig','url':'https://r7---sn-ci5gup-civl.googlevideo.com/videoplayback?expire=1606933954&ei=YonHX_XTBIKqvQSXv4-QDg ...........Command Line Inputusage:youtube[-h][-oOUTPUT][-l][-ff[FFMPEG]|-v[VIDEO]|-iITAG|-s|-a[AUDIO]|-r[RESOLUTION]|--version]url

Definitions:QualityTypes:('HIGH','MID','LOW')Videoresolutionexamples.('144','240','360','480','720','1080')more/lessdependonyourvideo

Note:Defaultvaluesfor'--ffmpeg','--video','--audio'is'HIGH'Defaultvaluesfor'--resolution'is720positionalarguments:urlEntervideoorplaylisturl

optionalarguments:-h,--helpshowthishelpmessageandexit-oOUTPUT,--outputOUTPUTOutputlocationfordownloadingstreams.-l,--logsToenableextralogs.-ff[FFMPEG],--ffmpeg[FFMPEG]FFMPEGdownloadsaudio/videoboththencopyinonefile,Passthequalitytype.-v[VIDEO],--video[VIDEO]Downlaodvideo(onlyprogressive),Passquality.-iITAG,--itagITAGDownloadstreamwithitag,Passitagid.-s,--streamsThisargumentwilllisttheallavailablestreams.-a[AUDIO],--audio[AUDIO]Downloadaudio,Passquality.-r[RESOLUTION],--resolution[RESOLUTION]Downloadstreamwithqualitytype,Passvideoresolution.--versionCheckthecurrentversionofyoutube.pySample CodesHere are some sample codes.How to download mass videos with ffmpeg.fromyoutubeimportVideovideo_url=["3AtDnEC4zak","3AtDnEC4zak"]forvdoinvideo_url:v=Video(f"https://youtu.be/{vdo}").streamsv.ffhigh.download()# ffhigh will download stream with highest qualityHow to download all playlist videos concurrently/fast.fromyoutubeimportPlayListimportconcurrent.futuresMAX_CONCURRENT_DOWNLOADS=1#max concurrent download at onesvideo_url="https://www.youtube.com/playlist?list=PLeXILI4F6_4XJau4ZlJXD7-K75g6rDebr"p=PlayList(video_url,process=True)# process=True to generate all Video objectsfunc=lambdax:x.streams.get_audios.low().download()withconcurrent.futures.ThreadPoolExecutor(max_workers=MAX_CONCURRENT_DOWNLOADS)asexecutor:forninexecutor.map(func,p.get_object):print(f'{n}Downloaded')ContributingYou just simple fork the project from github and fix the bugs and push with full explanation of bug and fix.We do love when you invest your time and contribute us for making us more better/stable.Your each bug report on github or contribute is much appreciated