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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -