How to add functions to python App - YT video dowloader?

Hello,
I’m trying to develop some projects for python beginners,
so I found this App for YouTube downloader source code,
I need to add some other fucntions:

  1. how to select the field where to save the file (video)? = (code)
  2. how to select the quality of the video, high resolution, sound only, low resolution = (code)
  3. how to export this app as exe file to be on the desktop?
    See the app source code in below, please help to add the above mentioned functions,
    ========================
    import tkinter as tk
    from pytube import YouTube

#Dispaly Window
dock = tk.Tk()
dock.geometry(‘500x300’)
dock.resizable(0,0)
dock.title(“Youtube Video Downloader”)
tk.Label(dock, text =“Youtube Video Downloader”, font =“arial 20 bold”).pack()

#Enter the URL
link = tk.StringVar()
tk.Label(dock, text =“Paste Link Here:”, font =“arial 15 bold”).place(x=160, y=60)
link_error = tk.Entry(dock, width =70, textvariable = link).place(x =32, y=90)

#Function to download the video
def Downloader():
url =YouTube(str(link.get()))
video =url.streams.first()
video.download()
tk.Label(dock, text =“Successfully Downloaded”, font =“arial 15”).place(x =180, y =200)

#Download Button
tk.Button(dock, text =“DOWNLOAD”, font =“Verdana 15 bold”, bg =“orange”, padx =2, command =Downloader).place(x=180, y=150)

dock.mainloop()

Hello! My name is Dylan, but my username is Cloovy.

I see you are trying to make a YouTube video downloader? Well I know a code that has already been made that downloads YouTube vids in mp3 or mp4 file formats. It was made in replit.com, an IDE in a browser.

Repl: https://replit.com/@JaspiDiceYT/Youtube-Downloader-V01

I can help you a bit more, but anyways, cya!

Probably the most well-known and longest-maintained downloader for
YouTube and similar video hosting platforms is implemented in Python
and has been published on PyPI for roughly a decade now:

https://pypi.org/project/youtube_dl

They’re constantly fixing it to cope with changes in those services
which break downloading, so it’s probably quite a treadmill to try
and maintain your own equivalent. I would rely on an existing
solution like that one, personally. The documentation even includes
tips for embedding it into another Python program as a library:

https://github.com/ytdl-org/youtube-dl#embedding-youtube-dl

Hope that helps!

1 Like