Python Tutorial – Youtube Videos GUI Downloader For Free
Python Tutorial – Youtube Videos GUI Downloader For Free
How to use this downloader
- you need to install python
- you need to have some text editor
- you need to install pip install tkinter
- you need to install pip install pytube
How to run this downloader
python file_name.py
Source Code
<div> <div> <div> <div># import all Tkinter libraries from the module</div> <div># from tkinter import Entry, Label, StringVar, Tk</div> <div>from tkinter import *</div> <div># From the installed Pytube module, import the youtube library</div> <div>frompytubeimportYouTube</div> <div>root = Tk()</div> <div>root.geometry('500x300') # Size of the window</div> <div>root.resizable(0, 0) # makes the window adjustable with its features</div> <div>root.title('youtube downloader')</div> <div>Label(root, text="Download Youtube videos for free", font='san-serif 14 bold').pack()</div> <div>link = StringVar() # Specifying the variable type</div> <div>Label(root, text="Paste your link here", font='san-serif 15 bold').place(x=150, y=55)</div> <div>link_enter = Entry(root, width=70, textvariable=link).place(x=30, y=85)</div> <div>def download():</div> <div> url = YouTube(str(link.get())) #This captures the link(url) and locates it from YouTube.</div> <div> video = url.streams.first() # This captures the streams available for downloaded for the video i.e. 360p, 720p, 1080p. etc.</div> <div> video.download() # This is the method with the instruction to download the video.</div> <div> Label(root, text="Downloaded", font="arial 15").place(x=170, y=120) #Once the video is downloaded, this label `downloaded` is displayed to show dowload completion.</div> <div>Button(root, text='Download', font='san-serif 16 bold',</div> <div>bg='green', padx=2,command=download).place(x=170, y=150)</div> <div>root.mainloop()</div> </div> </div> </div>