Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b2ac815

Browse files
Merge pull request avinashkranjan#620 from mehabhalodiya/YTVD
Added YouTube video downloader
2 parents dd2950a + 882c8a9 commit b2ac815

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

‎YouTube-Video-Downloader/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# YouTube Video Downloader
2+
3+
The objective of this project is to download any type of video in a fast and easy way from youtube in your device.
4+
5+
In this, user has to copy the youtube video URL that they want to download and simply paste that URL in the ‘paste link here’ section and click on the download button, it will start downloading the video. When video downloading finishes, it shows a message ‘downloaded’ popup on the window below the download button.
6+
7+
</br>
8+
9+
## Prerequisites
10+
11+
To implement this, we use basic concept of python, tkinter and pytube library.
12+
13+
- **Tkinter** is a standard GUI library and it is one of the easiest ways to build a GUI application.
14+
- **pytube** used for downloading videos from youtube
15+
16+
</br>
17+
18+
To install the required modules run pip installer command on the command line:
19+
20+
```
21+
pip install tkinter
22+
pip install pytube
23+
```
24+
25+
</br>
26+
27+
These are the following steps to build:
28+
29+
</br>
30+
31+
### Step 1: Import libraries
32+
33+
Start the project by importing the required modules.
34+
35+
In this script implementation, we import Tkinter and pytube modules.
36+
37+
</br>
38+
39+
### Step 2: Create display window
40+
41+
- **Tk()** used to initialize tkinter to create display window
42+
- **geometry()** used to set the window’s width and height
43+
- **resizable(0,0)** set the fix size of window
44+
- **title()** used to give the title of window
45+
- **Label()** widget use to display text that users can’t able to modify.
46+
- **root** is the name of the window
47+
- **text** which we display the title of the label
48+
- **font** in which our text is written
49+
- **pack** organized widget in block
50+
51+
</br>
52+
53+
### Step 3: Create field to enter link
54+
55+
- **link** is a string type variable that stores the youtube video link that the user enters.
56+
- **Entry()** widget is used when we want to create an input text field.
57+
- **width** sets the width of entry widget
58+
- **textvariable** used to retrieve the value of current text variable to the entry widget
59+
- **place()** use to place the widget at a specific position
60+
61+
</br>
62+
63+
### Step 4: Create function to start downloading
64+
65+
`url` variable gets the youtube link from the link variable by **get()** function and then **str()** will convert the link in string datatype.
66+
67+
The video is downloaded in the first present stream of that video by **stream.first()** method.
68+
69+
**Button()** widget used to display button on the window.
70+
71+
- **text** which we display on the label
72+
- **font** in which the text is written
73+
- **bg** sets the background color
74+
- **command** is used to call the function
75+
76+
**root.mainloop()** is a method that executes when we want to run the program.
77+
78+
</br>
79+
80+
### Output
81+
82+
After running this script, you will be able to see this:
83+
84+
</br>
85+
86+
![YTVD](https://user-images.githubusercontent.com/73488906/111301619-6eeaa100-8678-11eb-9ef2-5ce1b02571cf.png)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from tkinter import *
2+
from pytube import YouTube
3+
4+
root = Tk()
5+
root.geometry('700x300')
6+
root.resizable(0,0)
7+
root.title("YouTube Video Downloader")
8+
9+
Label(root,text = 'Copy the link of the video you want to download from YouTube', font = 'arial 15 bold').pack()
10+
11+
##enter link
12+
link = StringVar()
13+
14+
Label(root, text = 'Paste Link Here:', font = 'arial 15 bold').place(x = 270 , y = 60)
15+
Entry(root, width = 80,textvariable = link).place(x = 32, y = 90)
16+
17+
#function to download video
18+
19+
def Downloader():
20+
21+
url = YouTube(str(link.get()))
22+
video = url.streams.first()
23+
video.download()
24+
Label(root, text = 'DOWNLOADED', font = 'arial 15').place(x = 270 , y = 210)
25+
26+
Button(root,text = 'DOWNLOAD', font = 'arial 15 bold' ,bg = 'white', padx = 2, command = Downloader).place(x = 280 ,y = 150)
27+
28+
root.mainloop()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /