#here is a indept video
#https://www.youtube.com/watch?v=vEQ8CXFWLZU&list=WL&index=3
from pytube import YouTube
from sys import argv
link=input("Video: ")
argv.append(link)
#[0] is the code for argv
#[1] is the video you just inputed on the 7th line of code
link=argv[1]
youtube=YouTube(link)
#here is you can experiment and see how to get costum definition
you_download=youtube.streams.get_highest_resolution()
#inside download choose a folder were you want to save said video
you_download.download()
from pytube import Playlist
pl = Playlist("https://www.youtube.com/watch?v=Edpy1szoG80&list=PL153hDY-y1E00uQtCVCVC8xJ25TYX8yPU")
for video in pl.videos:
video.streams.first().download()
>>> from pytube import YouTube
>>> YouTube('https://youtu.be/9bZkp7q19f0').streams.first().download()
>>> yt = YouTube('http://youtube.com/watch?v=9bZkp7q19f0')
>>> yt.streams
... .filter(progressive=True, file_extension='mp4')
... .order_by('resolution')
... .desc()
... .first()
... .download()
from pytube import Playlist
ps = Playlist("https://www.youtube.com/watch?v=R6wQmWMDiB4&list=PLYmlEoSHldN4nV-Js4x7domjygiBkeatC")
for video in ps.videos:
video.streams.first().download()
$ pip install pytube
>>> yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
>>> from pytube import YouTube
For pytube3
>>> from pytube import YouTube
>>> YouTube('http://youtube.com/watch?v=9bZkp7q19f0').streams[0].download()