Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://pastebin.com/u/TTpocToXaKep
- from pytube import YouTube
- from tkinter import *
- # Get link from user
- link = input("Please enter a YouTube video link: ")
- # Create the YouTube object
- yt = YouTube(link)
- # Get the streams
- streams = yt.streams
- # Create Tkinter window
- root = Tk()
- # Set window title
- root.title('Download YouTube Video')
- # Set window size
- root.geometry('500x500')
- # Create function for each stream
- def one():
- streams[0].download()
- def two():
- streams[1].download()
- def three():
- streams[2].download()
- def four():
- streams[3].download()
- def five():
- streams[4].download()
- # Create download buttons
- btn1 = Button(root, text=streams[0], command=one).pack()
- btn2 = Button(root, text=streams[1], command=two).pack()
- btn3 = Button(root, text=streams[2], command=three).pack()
- btn4 = Button(root, text=streams[3], command=four).pack()
- btn5 = Button(root, text=streams[4], command=five).pack()
- # Run the window
- root.mainloop()
- # https://pastebin.com/u/TTpocToXaKep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement