-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
42 lines (34 loc) · 1 KB
/
test.py
File metadata and controls
42 lines (34 loc) · 1 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
from PyQt5 import QtWidgets
import sys
from yt_dlp import YoutubeDL
class Ui(QtWidgets.QMainWindow):
queue_path = ""
ydl_opts = {
"format": "bestaudio/best",
"quiet": True,
"verbose": False,
"postprocessors": [{
"key": "FFmpegExtractAudio",
"preferredcodec": "mp3",
"preferredquality": "192",
}],
"ffmpeg_location": "YtExtraFiles",
"ignoreerrors": True,
"continue": True,
"nooverwrites": True,
"no_warnings": True,
"noprogress": True,
"keepvideo": False
}
# ""
def __init__(self):
super(Ui, self).__init__()
self.search_btn = QtWidgets.QPushButton(self)
self.search_btn.clicked.connect(self.test_download)
def test_download(self):
with YoutubeDL(self.ydl_opts) as ydl:
ydl.download(['https://music.youtube.com/watch?v=MxEjnYdfLXU'])
app = QtWidgets.QApplication(sys.argv)
window = Ui()
window.show()
app.exec()