mirror of
https://github.com/Phantop/dotfiles
synced 2024-12-26 15:06:50 +00:00
24 lines
622 B
Python
Executable file
24 lines
622 B
Python
Executable file
#!/usr/bin/env python3
|
|
import sys
|
|
|
|
from PyQt6.QtCore import QUrl
|
|
from PyQt6.QtWidgets import QApplication
|
|
from PyQt6.QtWebEngineWidgets import QWebEngineView
|
|
|
|
def save_html(html):
|
|
if len(sys.argv) > 2 and sys.argv[2] == '-f':
|
|
filename = sys.argv[3] if len(sys.argv) > 3 else "dump.html"
|
|
with open(filename, 'w') as f:
|
|
f.write(html)
|
|
else:
|
|
print(html)
|
|
sys.exit()
|
|
|
|
if __name__ == '__main__':
|
|
app = QApplication(sys.argv)
|
|
wv = QWebEngineView()
|
|
|
|
wv.loadFinished.connect(lambda: wv.page().toHtml(save_html))
|
|
wv.load(QUrl.fromUserInput(sys.argv[1]))
|
|
app.exec()
|