我无法正确阅读以下网站。如果我使用Qt4将其转换为HTML并打印“内容”,我会用HTML回复整个页面,但是当我尝试使用bs4读取它时,它只返回页面的一半......?
url = 'http://www.scorespro.com/formula1/monaco-grand-prix-2013/race/'
class Render(QtWebKit.QWebPage):
print 'dfasadf'
def __init__(self, url):
self.app = QtGui.QApplication(sys.argv)
QtWebKit.QWebPage.__init__(self)
self.loadFinished.connect(self._loadFinished)
self.mainFrame().load(QtCore.QUrl(url))
self.app.exec_()
def _loadFinished(self, result):
self.frame = self.mainFrame()
self.app.quit()
r = Render(url)
content = unicode(r.frame.toHtml())
content = content
web_soup = BeautifulSoup(content)
print content, web_soup
有谁知道为什么这是..?