如何从网页下载动态生成的内容? [英] How to download dynamic generated content from webpage?

查看:76
本文介绍了如何从网页下载动态生成的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从动态生成的网页下载一些数据,因此无法使用wget。该页面为 http://gaceta.diputados.gob.mx/SIL/Legislaturas/ Listados.html 我想下载为每个选项显示的列表,这些选项可以在 Legislatura字段中选择。下载后,我可以处理红宝石中的数据。

I'm trying to download some data from a webpage that is dynamically generated, so using wget doesn't work. The page is http://gaceta.diputados.gob.mx/SIL/Legislaturas/Listados.html I want to download the list shown for each of the options that can be selected in the field "Legislatura" once downloaded I can process the data in ruby.

只是想知道什么是最好的下载方式,并且是否有可能选择每个选项并下载。

Just wanted to know what is the best way to download this, and if posible to select each of the options and download.

推荐答案

您可以使用Safari或Chrome中的Web检查器或Firefox中的Firebug扩展来查看数据的加载方式。该页面正在对该网站的Perl脚本执行AJAX POST请求,并且数据以XML形式返回。

You can use the Web Inspector in Safari or Chrome or the Firebug extension in Firefox to look at how the data is loaded. The page is doing an AJAX POST request to a Perl script for this website, and the data is return as XML.

我将使用 cURL 抓取数据。

这篇关于如何从网页下载动态生成的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆