-
Notifications
You must be signed in to change notification settings - Fork 139
/
Youtube_video_downloader
44 lines (36 loc) · 1.23 KB
/
Youtube_video_downloader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# importing tkinter Code
from tkinter import *
# importing YouTube module
from pytube import YouTube
# initializing tkinter
root = Tk()
# setting the geometry of the GUI
root.geometry("400x350")
# setting the title of the GUI
root.title("Youtube video downloader application")
# defining download function
def download():
try:
myVar.set("Downloading...")
root.update()
YouTube(link.get()).streams.first().download()
link.set("Video downloaded successfully")
except Exception as e:
myVar.set("Mistake")
root.update()
link.set("Enter correct link")
# created the Label widget to welcome user
Label(root, text="Welcome to youtube\nDownloader Application", font="Consolas 15 bold").pack()
# declaring StringVar type variable
myVar = StringVar()
# setting the default text to
myVar.set("Enter the link below")
# created the Entry widget to ask user to enter the url
Entry(root, textvariable=myVar, width=40).pack(pady=10)
#declaring StringVar type variable
link = StringVar()
#created the Entry widget to get the link
Entry(root, textvariable=link, width=40).pack(pady=10)
# created and called download function to download video
Button(root, text="Download video", command=download).pack()
root.mainloop()