Skip to content

Instantly share code, notes, and snippets.

@GavinDistaso
Created August 23, 2018 19:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save GavinDistaso/f9019983244868304c2bed15444dd54e to your computer and use it in GitHub Desktop.
Save GavinDistaso/f9019983244868304c2bed15444dd54e to your computer and use it in GitHub Desktop.
#C Gavin 2018
#imports
import os
from tkinter import *
#pip insall pytube
import pytube
import os, getpass
# def. the name of tkinter
app = Tk()
#app title
app.title("Youtube Downloader V1.5")
#sring of input field
rawurl = StringVar()
#listbox
l = Listbox(app, width=30, height=15)
l.insert(1, "Downloads")
l.insert(2, "Desktop")
l.insert(3, "Videos")
l.insert(4, "Music")
l.insert(5, "Documents")
#geometry of window
app.geometry("400x300")
#download def.
def download():
#selection of destination
sel =l.curselection()
#geting the input link
link = str(rawurl.get())
#progress print
print('Downloading...')
#Acual download
if sel == (0,):
pytube.YouTube(link).streams.first().download("C:/Users/" + str(getpass.getuser()) + "/Downloads/")
elif sel == (1,):
pytube.YouTube(link).streams.first().download("C:/Users/" + str(getpass.getuser()) + "/Desktop/")
elif sel == (2,):
pytube.YouTube(link).streams.first().download("C:/Users/" + str(getpass.getuser()) + "/Videos/")
elif sel == (1,):
pytube.YouTube(link).streams.first().download("C:/Users/" + str(getpass.getuser()) + "/Music/")
elif sel == (1,):
pytube.YouTube(link).streams.first().download("C:/Users/" + str(getpass.getuser()) + "/Documents/")
#progress print
print('done')
#closes window
app.destroy()
#listbox placement
l.place(x=200,y=0)
#entry
url = Entry(app,textvar = rawurl).place(x=0,y=0)
#download button
download = Button(app,text = 'Download',command = download).place(x=0,y=25)
#labels
urllabel = Label(text = 'Full url').place(x=125,y = 0)
label = Label(text = 'Youtube Downloader',font='none 16').place(x=0,y = 50)
label = Label(text = 'V1.5',font='none 16').place(x=0,y = 75)
urllabel = Label(text = 'Destination').place(x=125,y = 25)
#end of tkinter program
app.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment