Programmatic Form Submit

前端 未结 4 493
遥遥无期
遥遥无期 2021-01-14 16:26

I want to scrape the contents of a webpage. The contents are produced after a form on that site has been filled in and submitted.

I\'ve read on how to scrape the en

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 17:18

    Using python, I think it takes the following steps:

    1. parse the web page that contains the form, find out the form submit address, and the submit method ("post" or "get").

    this explains form elements in html file

    1. Use urllib2 to submit the form. You may need some functions like "urlencode", "quote" from urllib to generate the url and data for post method. Read the library doc for details.

提交回复
热议问题