Pythonista
Pythonista copied to clipboard
Got scraper working
No time to make a separate pull request for this, but I got the scraper working:
import ui
import time
class Scraper (object):
def __init__(self, url, js = 'document.documentElement.outerHTML'):
self.wv = ui.WebView()
self.wv.delegate = self
self.wv.load_url(url)
self.js = js
self.response = None
def webview_did_finish_load(self, webview):
self.response = webview.eval_js(self.js)
@property
def value(self):
while self.response is None:
time.sleep(0.1)
return self.response
def main():
v = Scraper(url, 'document.documentElement.outerHTML;').value
It is a bit of a hack and probably not all that efficient, but it works perfectly
Hi, thanks I will check and update the script. Sometimes it takes time to answer and merge pull requests but thanks for keeping the repo up to date.