mirror of
https://github.com/Phantop/dotfiles
synced 2025-12-10 05:58:35 +00:00
bin: adjust qtcurl and shub for full works
This commit is contained in:
parent
ba3f91e1ca
commit
befa249a5b
14
bin/qtcurl
14
bin/qtcurl
|
|
@ -2,8 +2,10 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PyQt6.QtCore import QUrl
|
from PyQt6.QtCore import QUrl
|
||||||
from PyQt6.QtWidgets import QApplication
|
from PyQt6.QtNetwork import QNetworkCookie
|
||||||
|
from PyQt6.QtWebEngineCore import QWebEngineProfile, QWebEngineCookieStore
|
||||||
from PyQt6.QtWebEngineWidgets import QWebEngineView
|
from PyQt6.QtWebEngineWidgets import QWebEngineView
|
||||||
|
from PyQt6.QtWidgets import QApplication
|
||||||
|
|
||||||
def save_html(html):
|
def save_html(html):
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == '-f':
|
if len(sys.argv) > 2 and sys.argv[2] == '-f':
|
||||||
|
|
@ -15,8 +17,16 @@ def save_html(html):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
url = QUrl.fromUserInput(sys.argv[1])
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
wv = QWebEngineView()
|
profile = QWebEngineProfile()
|
||||||
|
cookiestore = profile.cookieStore()
|
||||||
|
cookies = ['toc_show=999']
|
||||||
|
for i in cookies:
|
||||||
|
cookie = QNetworkCookie.parseCookies(i.encode('utf-8'))[0]
|
||||||
|
cookiestore.setCookie(cookie, url)
|
||||||
|
wv = QWebEngineView(profile)
|
||||||
|
|
||||||
wv.loadFinished.connect(lambda: wv.page().toHtml(save_html))
|
wv.loadFinished.connect(lambda: wv.page().toHtml(save_html))
|
||||||
wv.load(QUrl.fromUserInput(sys.argv[1]))
|
wv.load(QUrl.fromUserInput(sys.argv[1]))
|
||||||
|
|
|
||||||
10
bin/shub
10
bin/shub
|
|
@ -15,15 +15,17 @@ for i in $chaps
|
||||||
while true
|
while true
|
||||||
set page (qtcurl $i)
|
set page (qtcurl $i)
|
||||||
if test -z "$page"
|
if test -z "$page"
|
||||||
continue
|
echo "Invalid url: $i"
|
||||||
|
exit
|
||||||
end
|
end
|
||||||
if test (echo $page | pup title text{}) = "Just a moment...\n"
|
if test (echo $page | pup title text{}) = "Just a moment..."
|
||||||
open $i
|
open $i
|
||||||
echo "Solve captcha in browser, then press enter."
|
echo "Solve captcha in browser, then press enter."
|
||||||
read
|
read
|
||||||
else
|
sleep 5
|
||||||
break
|
continue
|
||||||
end
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
set num (echo $i | rev | cut -d/ -f2 | rev)
|
set num (echo $i | rev | cut -d/ -f2 | rev)
|
||||||
set ch_title (echo $page | pup title text{})
|
set ch_title (echo $page | pup title text{})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue