Get help with morph.io and scraping

Phantomjs https

from splinter import Browser

with Browser("phantomjs") as browser:
    # Optional, but make sure large enough that responsive pages don't
    # hide elements on you...
    browser.driver.set_window_size(1280, 1024)

    # Open the page you want...
    browser.visit("https://morph.io")

    # submit the search form...
    browser.fill("q", "parliament")
    button = browser.find_by_css("button[type='submit']")
    button.click()

    # Scrape the data you like...
    links = browser.find_by_css(".search-results .list-group-item")
    for link in links:
        print link['href']

Phantomjs is not working on https urls, can you help me with that ?

Hi @Hastu.

I just gave this sample a run on a little windows 10 box, and it seemed to work ok:

(tmpenv) D:\src>python morph_test.py
https://morph.io/tshiunghan/malaysian_parliament_hansard_url
https://morph.io/tmtmtmtm/malawi_parliament
https://morph.io/mihi-tr/mps_tanzania
https://morph.io/fvasquezl/members_of_the_uk_parliament
https://morph.io/soit-sk/slovakia_parliament
https://morph.io/jliski/members_of_finnish_parliament_scraper
https://morph.io/fpigna/hungarian_parliament_spending
https://morph.io/soit-sk/excused_absence_requests_of_slovak_parliament_memb
https://morph.io/struan/netherlands
https://morph.io/tmtmtmtm/malaysian_parliament 

Maybe you can give the url you’re trying & error you’re seeing?

1 Like