0
Ich versuche, dynamische Web-Scraping auf PyQt5 zu lernen. Ich habe die Tutorials für PyQt4 nachgeschlagen, also habe ich verschiedene Bibliotheken in Qt5.Kann nicht verwenden Qrl
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEnginePage
import bs4 as bs
import urllib.request
class Client(QWebEnginePage):
def _init_(self, url):
self.app=QApplication(sys.argv)
QWebPage._init_(self)
self.loadFinished.connect(self.on_page_load)
self.mainFrame().load(QUrl(url))
self.app.exec_()
def on_page_load(self):
self.app.quit()
url='https://pythonprogramming.net/parsememcparseface/'
client_response=Client(url)
source=client_response.mainFrame().toHtml()
#sauce=urllib.request.urlopen('https://pythonprogramming.net/sitemap.xml').read()
soup=bs.BeautifulSoup(sauce,'xml')
js_test=soup.find('p',class_='jstest')
print(js_test.text)
Der folgende Fehler wird zeigen:
Traceback (most recent call last):
File "jsp.py", line 19, in <module>
client_response=Client(url)
TypeError: arguments did not match any overloaded call:
QWebEnginePage(parent: QObject = None): argument 1 has unexpected type 'str'
QWebEnginePage(QWebEngineProfile, parent: QObject = None): argument 1 has unexpected
mir jemand helfen!
Dank @eyllanesc –