The code basically takes regular paragraph tags, with the class of
jstest, and initially returns the text
jstest paragraph data to be
If you open the page in your web browser, we'll see the shinin message, so we'll try in Beautiful Soup:
import bs4 as bs import urllib.request source = urllib.request.urlopen('https://pythonprogramming.net/parsememcparseface/') soup = bs.BeautifulSoup(source,'lxml') js_test = soup.find('p', class_='jstest') print(js_test.text)
y u bad tho?
import sys from PyQt4.QtGui import QApplication from PyQt4.QtCore import QUrl from PyQt4.QtWebKit import QWebPage import bs4 as bs import urllib.request class Client(QWebPage): 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() soup = bs.BeautifulSoup(source, 'lxml') js_test = soup.find('p', class_='jstest') print(js_test.text)
Look at you shinin!
Just in case you wanted to make use of dryscrape:
import dryscrape sess = dryscrape.Session() sess.visit('https://pythonprogramming.net/parsememcparseface/') source = sess.body() soup = bs.BeautifulSoup(source,'lxml') js_test = soup.find('p', class_='jstest') print(js_test.text)