python - Retrieving scripted page urls via web scrape -
i'm trying of article link web scrapped search query, don't seem results.
my approach: i'm trying ids of articles , append them known url (http://www.seek.com.au/job/+ id) there no ids on request(python package http://docs.python-requests.org/en/latest/) retrieval, in fact there no articles @ all.
it seems in particular case need execute scripts(that generate ids) in way full data, how that?
maybe there other ways retrieve of results search query?
as mentioned, download selenium. there python bindings.
selenium web testing automation framework. in effect, using selenium remote controlling web browser. necessary web browsers have javascript engines , doms, allowing ajax occur.
using test script (it assumes have firefox installed; selenium supports other browsers if needed):
# import 3rd party libraries selenium import webdriver selenium.webdriver.common.desired_capabilities import desiredcapabilities class requester_firefox(object): def __init__(self): self.selenium_browser = webdriver.firefox() self.selenium_browser.set_page_load_timeout(30) def __del__(self): self.selenium_browser.quit() self.selenium_browser = none def __call__(self, url): try: self.selenium_browser.get(url) the_page = self.selenium_browser.page_source except exception: the_page = "" return the_page test = requester_firefox() print test("http://www.seek.com.au/jobs/in-australia/#daterange=999&worktype=0&industry=&occupation=&graduatesearch=false&salaryfrom=0&salaryto=999999&salarytype=annual&advertiserid=&advertisergroup=&keywords=police+check&page=1&isareaunspecified=false&location=&area=&nation=3000&sortmode=advertiser&searchfrom=quick&searchtype=").encode("ascii", "ignore") it load seek , wait ajax pages. encode method necessary (for me @ least) because seek returns unicode string windows console seemingly can't print.
Comments
Post a Comment