Skip to content

Commit acb12b7

Browse files
author
SRIHARI S
committed
added youtube video download with GUI
Signed-off-by: SRIHARI S <[email protected]>
1 parent d4f8cff commit acb12b7

File tree

7 files changed

+105
-1
lines changed

7 files changed

+105
-1
lines changed

Image Watermark Generator/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ In this code, I implemented the code by using the following concepts:
3030
![image](./lion_watermarked.jpg)
3131

3232

33-
I wish you enjoy guess this code :-D
33+
I wish you enjoy this code :-D
3434

3535
**SRIHARI S**

Youtube Downloader/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
**YOUTUBE DOWNLOADER**
2+
3+
**GOAL**
4+
This is a gui based youtube downloader created in python programming language. You can download any youtube video by using this code.
5+
6+
7+
**DESCRIPTION**
8+
The goal is to download any youtube video by using the youtube video url and save it in the local machine based on the user's input.
9+
10+
To use this code download youtubeDownloaderGUI.py and resources in the same directory.
11+
+ Open and run the file youtubeDownloaderGUI.py
12+
+ enjoy the code :-D
13+
14+
**WHAT I HAD DONE**
15+
In this code, I implemented the code by using the following concepts:
16+
+ Tkinter module
17+
+ pytube module
18+
+ os module
19+
20+
**DEMONSTRATION**
21+
![image](./images/app.png)
22+
![image](./images/detailsFilled.png)
23+
![image](./images/downloadSuccess.png)
24+
![image](./images/lionRoarVideo.png)
25+
26+
I wish you enjoy this code :-D
27+
28+
**SRIHARI S**

Youtube Downloader/images/app.png

36.9 KB
Loading
47.4 KB
Loading
61.5 KB
Loading
3.11 MB
Loading
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import os
2+
import tkinter as tk
3+
from tkinter import messagebox
4+
from tkinter import filedialog
5+
import pytube
6+
# if you get an error here, run this command in terminal: pip install pytube
7+
8+
def downloadVideo():
9+
if(entry1.get() == "" or entry2.get() == "" or entry3.get() == "" or entry4.get() == ""):
10+
messagebox.showerror("Error", "Please fill all the fields.")
11+
return
12+
13+
url = entry1.get()
14+
path = entry2.get()
15+
name = entry3.get()
16+
resolution = entry4.get()
17+
18+
if(resolution != "360p" and resolution != "720p" and resolution != "1080p"):
19+
messagebox.showerror("Error", "Please enter a valid resolution.")
20+
return
21+
22+
if(os.path.exists(path) == False):
23+
messagebox.showerror("Error", "Please enter a valid path.")
24+
return
25+
26+
if(os.path.exists(path + "\\" + name + ".mp4") == True):
27+
messagebox.showerror("Error", "File already exists.")
28+
return
29+
30+
try:
31+
yt = pytube.YouTube(url)
32+
video = yt.streams.filter(res=resolution).first()
33+
video.download(path, name)
34+
messagebox.showinfo("Success", "Video downloaded successfully.")
35+
except:
36+
messagebox.showerror("Error", "Please enter a valid url.")
37+
38+
window = tk.Tk()
39+
window.title("Youtube Downloader")
40+
window.geometry("600x400")
41+
window.resizable(False, False)
42+
43+
label1 = tk.Label(window, text="Youtube Downloader", font=("Arial", 20))
44+
label1.pack()
45+
46+
label2 = tk.Label(window, text="Enter the url of the video: ", font=("Arial", 10))
47+
label2.pack()
48+
49+
entry1 = tk.Entry(window, width=50)
50+
entry1.pack()
51+
52+
label3 = tk.Label(window, text="Enter the path where you want to save the video: ", font=("Arial", 10))
53+
label3.pack()
54+
55+
entry2 = tk.Entry(window, width=50)
56+
entry2.pack()
57+
58+
button1 = tk.Button(window, text="Browse", command=lambda: entry2.insert(0, filedialog.askdirectory()))
59+
button1.pack()
60+
61+
label4 = tk.Label(window, text="Enter the name of the video: (with extension)", font=("Arial", 10))
62+
label4.pack()
63+
64+
entry3 = tk.Entry(window, width=50)
65+
entry3.pack()
66+
67+
label5 = tk.Label(window, text="Enter the resolution of the video (360p, 720p, 1080p): ", font=("Arial", 10))
68+
label5.pack()
69+
70+
entry4 = tk.Entry(window, width=50)
71+
entry4.pack()
72+
73+
button2 = tk.Button(window, text="Download", command=downloadVideo)
74+
button2.pack()
75+
76+
window.mainloop()

0 commit comments

Comments
 (0)