-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyoutube.py
More file actions
32 lines (26 loc) · 747 Bytes
/
youtube.py
File metadata and controls
32 lines (26 loc) · 747 Bytes
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
import tkinter as tk
from pytube import YouTube
def downloadVid():
global E1
string = E1.get()
yt = YouTube(str(string))
#videos = yt.get_videos()
stream = yt.streams.first()
stream.download()
s = 1
for v in stream:
print(str(s) + '.' + str(v))
s+= 1
n = int(input("Enter your choice"))
vid = videos[n-1]
destination = str(input("Enter your destination"))
vid.download(destination)
print(yt.filename + "\n video been downloaded")
root = tk.Tk()
w = tk.Label(root, text = "Youtube Downloader")
w.pack()
E1 = tk.Entry(root, bd = 5)
E1.pack(side = tk.TOP)
button = tk.Button(root, text = "Download", fg = "red", command = downloadVid)
button.pack(side = tk.BOTTOM)
root.mainloop()