python - 如何从以色列统计局网络查询工具中抓取数据?

标签 python perl r screen-scraping security

以下网址:

http://www.cbs.gov.il/ts/ID40d250e0710c2f/databank/series_func_e_v1.html?level_1=31&level_2=1&level_3=7

提供来自以色列政府的信息数据生成器,它将提取的数据点数量限制为一次最多 50 个系列。我想知道,是否有可能(如果可以,如何)编写一个网络爬虫(用您最喜欢的语言/软件),它可以跟踪每个步骤的点击,从而能够获取特定主题的所有系列。

谢谢。

最佳答案

看看WWW::MechanizeWWW::HtmlUnit .

#!/usr/bin/perl

use strict;
use warnings;

use WWW::Mechanize;

my $m = WWW::Mechanize->new;

#get page
$m->get("http://www.cbs.gov.il/ts/ID40d250e0710c2f/databank/series_func_e_v1.html?level_1=31&level_2=1&level_3=7");

#submit the form on the first page
$m->submit_form(
    with_fields => {
        name_tatser => 2, #Orders for export
    }
);

#now that we have the second page, submit the form on it
$m->submit_form(
    with_fields => {
        name_ser => 1576, #Number of companies that answered
    }
);

#and so on...

#printing the source HTML is a good way
#to find out what you need to do next
print $m->content;

关于python - 如何从以色列统计局网络查询工具中抓取数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6429618/

相关文章:

regex - Perl - 合并多个正则表达式而不重新编号?

r - dplyr:向组内的重复值添加抖动

r - ggplot2标签位置不居中

python - 类查找函数python

python - 如何在flask-jwt-extended中获取当前用户(id)?

regex - 加载 Regexp::Grammars 后使用 "normal"正则表达式

mysql - 当记录以下划线开头时出现重复条目​​错误

Python,使用 .itervalues() 检查字典中的值会在比较时返回不同的结果

python - Django 中的单模型动态数据库设置

r - R中的for循环问题