3 Lines of Code And You Can Download Your Favourite Youtube Video.
Lets Dive Into the code. Firstly you need to install pytube using pip install pytube. You then need to import pytube library I have used sys library to take input from command line you dont need it Just replace your url with sys.argv[1] Please find the sample url https://www.youtube.com/watch?v=Jx5Vn4F0OBc&t=45s You then need to stream the first video from the object yt Finally use download method and dowload it to your desktop location Here I have given my desktop location,you can replace it with yours. Thats it walla!!! import pytube import sys # replace sys.argv[1] with your youtube link yt = pytube.YouTube(sys.argv[ 1 ]) stream = yt.streams.first() stream.download( "D:/" ) print ( "Video Downloaded" )

Comments
Post a Comment