虽然
HTML Scraping从我所看到的内容中得到了很好的记录,并且我理解了它的概念和实现,但是从隐藏在身份验证表单后面的内容中抓取的最佳方法是什么.我指的是从我合法访问的内容中抓取,所以我正在寻找一种自动提交登录数据的方法.
我能想到的只是设置代理,从手动登录中捕获吞吐量,然后设置脚本以欺骗吞吐量,作为HTML抓取执行的一部分.就语言而言,可能会在Perl中完成.
有没有人有这方面的经验,或只是一般的想法?
编辑
这是answered before但是使用.NET.虽然它验证了我认为应该如何完成,但有没有人有Perl脚本来执行此操作?
解决方法
查看Perl
WWW::Mechanize库 – 它建立在LWP之上,提供用于完成您所引用的那种交互的工具,并且它可以在您处理cookie时保持状态!
WWW::Mechanize,or Mech for short,helps you automate interaction with a website. It supports performing a sequence of page fetches including following links and submitting forms. Each fetched page is parsed and its links and forms are extracted. A link or a form can be selected,form fields can be filled and the next page can be fetched. Mech also stores a history of the URLs you’ve visited,which can be queried and revisited.