web scraping - How to work with mechanise python -
i trying data 1 news website. need use internal search engine of website. think there problem in getting javascript generated content can problem?
import mechanize br = mechanize.browser() search_for = 'stack' url = 'http://www.delfi.lt/paieska/?q={}'.format(search_for) htmlfile = br.open(url) webtext = htmlfile.read() print webtext
i expcet return text including search results. however, not return search results.
i got voted down. ok, please provide me feedback, wrong question.
they using custom google search, loaded through javascript. have 3 options:
- load page in headless browser, phantomjs/casperjs.
- replicate javascript in python. (bad option)
- use googles search api yourself.
you cannot use mechanize such tasks.
Comments
Post a Comment