-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYoutubeDownloader.py
More file actions
47 lines (38 loc) · 1.31 KB
/
YoutubeDownloader.py
File metadata and controls
47 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#Author: Emil
#Description: GUI to allow user to input YouTube link in order for them to download it
#ISSUE: pytube returns 404 error which other users have experienced as well. waiting for fix for that one
from pytube import YouTube
import sys
from PyQt5.QtWidgets import (
QApplication,
QGridLayout,
QPushButton,
QLabel,
QLineEdit,
QWidget
)
class Downloader(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Youtube Video Downloader")
layout = QGridLayout()
self.download_progress = QLabel(self)
button = QPushButton('->')
self.textfield = QLineEdit(self)
layout.addWidget(QLabel("Enter Link Here: "), 0, 0)
layout.addWidget(self.textfield, 0, 1)
layout.addWidget(button, 0, 2)
layout.addWidget(self.download_progress, 1, 0)
button.clicked.connect(self.on_pushed)
self.setLayout(layout)
def on_pushed(self):
yt = YouTube(self.textfield.text())
video = yt.streams.get_highest_resolution()
download_progress.setText("Download In Progress.....")
video.download()
download_progress.setText("Download Complete!")
if __name__ == "__main__":
app = QApplication(sys.argv)
window = Downloader()
window.show()
sys.exit(app.exec_())