File size: 1,082 Bytes
0aee47a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Bibibili API Documentions

import sys
import webbrowser

try:
    from PyQt5 import QtGui, QtCore, QtWidgets, QtWebEngineWidgets
except:
    PYQT5 = False
else:
    PYQT5 = True


def main():
    if not PYQT5:
        webbrowser.open("https://nemo2011.github.io/bilibili-api")
    else:
        QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
        app = QtWidgets.QApplication(sys.argv)
        mainwindow = QtWidgets.QMainWindow()
        mainwindow.resize(800, 600)
        webengine = QtWebEngineWidgets.QWebEngineView(mainwindow)
        webengine.setGeometry(QtCore.QRect(0, 0, 800, 600))
        webengine.setUrl(QtCore.QUrl("https://nemo2011.github.io/bilibili-api"))

        def timerEvent(*args, **kwargs):
            webengine.setGeometry(
                QtCore.QRect(0, 0, mainwindow.width(), mainwindow.height())
            )

        mainwindow.timerEvent = timerEvent
        mainwindow.startTimer(1)
        mainwindow.show()
        sys.exit(app.exec_())


if __name__ == "__main__":
    main()