[第23期]Use pytube and PySide to download YouTube audio(mp3)/使用pytube與PySide下載YouTube聲音檔(mp3)
This vedio shows how to use pytube and PySide to download YouTube audio (mp3).
The content includes:
PySide Introduction
Filter Audio Stream
Download and rename Youtube mp3 file
本視頻說明如何使用pytube與PyQt下載YouTube影片。
內容包含:
PySide簡介
篩選聲音資料流
下載和重新命名YouTube MP3檔
Pyside template
import sys
from PySide6 import QtWidgets
from PySide6.QtCore import QFile, QIODevice
from PySide6.QtUiTools import QUiLoader
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, ui_file_name, *args, **kwargs):
# access methods of the base class
super(MainWindow, self).__init__(*args, **kwargs)
# Load the UI Page by PySide6
loader = QUiLoader()
file = QFile(ui_file_name)
file.open(QIODevice.ReadOnly)
self.ui = loader.load(file)
file.close()
self.ui.setWindowTitle("ui title")
self.ui.show()
def main():
app = QtWidgets.QApplication(sys.argv)
ui_file_name = "ui_file.ui"
main = MainWindow(ui_file_name)
sys.exit(app.exec())
if __name__ == '__main__':
main()
留言