简体   繁体   中英

Web scraping a page with Javascript using Python

I am trying to scrape a web page that is a list of urls using Python. I can scrape the first page with no problem using Python and beautiful soup, however if the the url list is long it continues on a second page using the following JavaScript.

href="javascript:__doPostBack('WQResultGridView','Page$2')

I don't know how to get to the second page.

I guess this call would be translated into an http (post, as the name suggests) request.

look at firebug's 'net' tab for how that request is structured and run the same request using python.

another, more generic way to handle this would be to load the page and run the javascript it holds using a tool like http://phantomjs.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM