httprequest - Python 3.X Extract Source Code ONLY when page is done loading -


i submit query on web page. query takes several seconds before done. when done display html table information from. let's query takes maximum of 4 seconds load. while prefer data loaded, acceptable wait 4 seconds data table.

the issue have when make urlread request, page hasn't finished loading yet. tried loading page, issuing sleep command, loading again, not work either.

my code

import urllib.request import time  uf = urllib.request.urlopen(urlname) time.sleep(3) uf.decode('utf-8') text = uf.read() print (text)  

the webpage looking @ http://bookscouter.com/prices.php?isbn=9781111835811 (feel free ignore interesting textbook haha)

and using python 3.x on raspberry pi

the prices want not in page you're retrieving, no amount of waiting make them appear. instead, prices retrieved javascript in page after has loaded. urllib module not browser, won't run script you. you'll want figure out url ajax request (a quick @ source code gives pretty big hint) , retrieve instead. it's going in json format can use python's json module parse it.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -