├── README.md └── main.py /README.md: -------------------------------------------------------------------------------- 1 | # Python GUI YouTube Video Downloader 2 | 3 | This is a Python GUI application that allows users to download YouTube videos in various formats and resolutions. 4 | 5 | ![app_gui](https://i.imgur.com/PikBPS2.png) 6 | 7 | ## Installation 8 | 9 | 1. Clone the repository or download the zip file. 10 | 2. Install the required libraries by running `pip install -r requirements.txt` in your terminal. 11 | 3. Run the `main.py` file to start the application. 12 | 13 | ## Usage 14 | 15 | 1. Enter the YouTube video link in the text field provided. 16 | 2. Select the format and resolution of the video to be downloaded. 17 | 3. Choose the download location by clicking the "Browse" button. 18 | 3. Click the "Download" button to start the download. 19 | 20 | ## Features 21 | - User-friendly graphical user interface. 22 | - Supports downloading YouTube videos in various formats and resolutions. 23 | - Allows users to choose the download location. 24 | - Shows download progress and estimated time remaining. 25 | 26 | ## Contributing 27 | Contributions are welcome! Please fork the repository and submit a pull request. 28 | 29 | ## License 30 | This project is licensed under the MIT License. See the [LICENSE]() file for more information. 31 | 32 | ## Contact 33 | Andrew Tsegaye - [andrew@jsmastery.pro](mailto:andrewtsegaye@gmail.com) 34 | 35 | Project Link: [https://github.com/Andrew-Tsegaye/Project_Python_GUI_YouTube_Vid_Downloader](https://github.com/Andrew-Tsegaye/Project_Python_GUI_YouTube_Vid_Downloader) 36 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import customtkinter 3 | from pytube import YouTube 4 | 5 | 6 | def start_download(): 7 | try: 8 | ytLink = link.get() 9 | ytObject = YouTube(ytLink, on_progress_callback=on_progress) 10 | video = ytObject.streams.get_highest_resolution() 11 | 12 | title.configure(text=ytObject.title, text_color="white") 13 | finishLable.configure(text="") 14 | video.download() 15 | finishLable.configure(text="Downloaded!") 16 | except: 17 | finishLable.configure(text="Downloaded Error!", text_color="red") 18 | 19 | def on_progress(stream, chunk, bytes_remaining): 20 | total_size = stream.filesize 21 | bytes_download = total_size - bytes_remaining 22 | percentage_of_completion = bytes_download / total_size * 100 23 | per = str(int(percentage_of_completion)) 24 | pPercentage.configure(text=per + "%") 25 | pPercentage.update() 26 | 27 | # Update progress bar 28 | progressBar.set(float(percentage_of_completion / 100)) 29 | 30 | # System Settings 31 | customtkinter.set_appearance_mode("System") 32 | customtkinter.set_default_color_theme("green") 33 | 34 | # App frame 35 | app = customtkinter.CTk() 36 | app.geometry("720x480") 37 | app.title("YouTube Downloader") 38 | 39 | # Font 40 | my_font = customtkinter.CTkFont(family="sans-serif", size=28) 41 | 42 | # Adding UI Elements 43 | title = customtkinter.CTkLabel(app, text="Insert a YouTube link", font=my_font) 44 | title.pack(padx=10, pady=40) 45 | 46 | # Link input 47 | url_var = tkinter.StringVar() 48 | link = customtkinter.CTkEntry(app, width=350, height=40, font=customtkinter.CTkFont(family="sans-serif", size=16), textvariable=url_var) 49 | link.pack() 50 | 51 | # Finished Downloading 52 | finishLable = customtkinter.CTkLabel(app, text="") 53 | finishLable.pack() 54 | 55 | # Progress percentage 56 | pPercentage = customtkinter.CTkLabel(app, text="0%") 57 | pPercentage.pack() 58 | 59 | progressBar = customtkinter.CTkProgressBar(app, width=400) 60 | progressBar.set(0) 61 | progressBar.pack(padx=10, pady=10) 62 | 63 | # Download Button 64 | download = customtkinter.CTkButton(app, text="Download", command=start_download) 65 | download.pack(padx=10, pady=10) 66 | 67 | # Run app 68 | app.mainloop() 69 | --------------------------------------------------------------------------------