United States Department of Agriculture 美国农业部网站数据自动下载小脚本
帮对象写的自动点击页面的小脚本,如果有需要的可以试试,(#^.^#)
https://apps.fas.usda.gov/gats/ExpressQuery1.aspx
var year = '1991'; var box3 = document.querySelector("#ctl00_ContentPlaceHolder1_lb_Partners");
box3.value='ALLRG';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_lb_Products");
box3.value='M1';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlValueUnit");
box3.value='M';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlDateSeries");
box3.value='Annual';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlOrderBy");
box3.value='CODE';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlInDetail");
box3.value='Product';
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlCalculation");
box3.value=''; box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlStartYear");
box3.value= year;
box3.dispatchEvent(new Event('change'));
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_ddlEndYear");
box3.value= year;
box3.dispatchEvent(new Event('change')); function clickStep()
{
if (document.querySelector("#overlay").style.display == 'block') {
setTimeout("clickStep()", 1000);
return;
}
console.log("触发点击事件")
document.querySelector("#ctl00_ContentPlaceHolder1_btnRetrieveData").click();
}
setTimeout("clickStep()", 1000); String.prototype.startWith=function(str){
var reg=new RegExp("^"+str);
return reg.test(this);
}
var clicked = false;
function doExpand() {
box3 = document.querySelector("#ctl00_ContentPlaceHolder1_UltraWebTab1__ctl1_grdExpressQuery_GridView1");
var rows = box3.rows;
var inputs = [];
for (var index in rows) {
var length = rows[index].cells ? rows[index].cells.length : 0;
if (length < 4) {
continue;
}
var nodes = rows[index].cells[3].childNodes;
if (nodes.length == 0) {
continue;
}
if (nodes[0].nodeName == '#text') {
continue;
}
var cell5Text = rows[index].cells[4].innerText;
if (!cell5Text.startWith('Bulk Total') && !cell5Text.startWith('Intermediate Total') && !cell5Text.startWith('Consumer Oriented Total')) {
continue;
} var input = nodes[0]; if(input.value == '-') {
continue;
} clicked = true;
input.click();
break;
}
} var index = 0;
function expandStep()
{
if (document.querySelector("#overlay").style.display == 'block' || document.querySelector("#ctl00_ContentPlaceHolder1_UltraWebTab1") == null) {
setTimeout("expandStep()", 1000);
return;
}
console.log((index++) + "打开,total:" );
doExpand();
if (!clicked) {
alert("展开完成,请下载")
return;
} else {
clicked = false;
}
expandStep();
} setTimeout("expandStep()", 5000);
United States Department of Agriculture 美国农业部网站数据自动下载小脚本的更多相关文章
- 163k地方门户网站系统自动审核信息脚本
本代码实现对163k地方门户网站系统发布信息的自动审核,以及对内容中链接全过滤 软件安装 Python 安装 http://www.python.org/download/ pymssql安装 htt ...
- 31.网站数据监控-2(scrapy文件下载)
温州数据采集 这里采集网站数据是下载pdf:http://wzszjw.wenzhou.gov.cn/col/col1357901/index.html(涉及的问题就是scrapy 文件的下载设置,之 ...
- opencart配置United States Postal Service快递
1.安装United States Postal Service 2.登录https://registration.shippingapis.com/,注册帐号,稍后会收到邮件 3.打开邮件,记下Us ...
- 抓取网站数据不再是难事了,Fizzler(So Easy)全能搞定
首先从标题说起,为啥说抓取网站数据不再难(其实抓取网站数据有一定难度),SO EASY!!!使用Fizzler全搞定,我相信大多数人或公司应该都有抓取别人网站数据的经历,比如说我们博客园每次发表完文章 ...
- DEDECMS网站数据备份还原教程
备份织梦网站数据 dedecms备份教程 进入DedeCms后台 -> 系统 -> 数据库备份/还原 备份文件在\data\backupdata 下载数据库备份资料\data\backup ...
- 解决MS Office下载网站数据失败的问题
最近遇到在MS Excel中建立的Web Query在创建完成后过了一段时间(或关闭文件后再次打开文件并刷新数据)出现无法刷新的问题,点击刷新时报错如下: 无法下载您要求的信息. 这是一个很不友好的报 ...
- 利用linux curl爬取网站数据
看到一个看球网站的以下截图红色框数据,想爬取下来,通常爬取网站数据一般都会从java或者python爬取,但本人这两个都不会,只会shell脚本,于是硬着头皮试一下用shell爬取,方法很笨重,但旨在 ...
- Python_记一次网站数据定向爬取实现
记一次网站数据定向爬取实现 by:授客 QQ:1033553122 测试环境: Python版本:Python 3.4 Win7 请勿用于商业及非法用途,仅供学习研究用,否则后果自负 数据爬取场景 如 ...
- 用Python下载美国国家气候数据中心(NCDC)的气候数据
美国国家气候数据中心的官网地址是https://www.ncdc.noaa.gov/ 气候数据的下载地址是: 长格式:ftp://ftp.ncdc.noaa.gov/pub/data/noaa/,这种 ...
随机推荐
- Web项目中的 /
如果 / 出现在路径的前面: web.xml中:http://loclalhost:8080/项目名称/ 在项目的根路径下面 jsp中: http://localhost:8080/ ...
- c++ 套路多
1. 浅拷贝带来的多次析构问题 参见:https://www.cnblogs.com/33debug/p/6657730.html 解决方案,深拷贝.强烈建议自定义拷贝构造函数为深拷贝,否则可能会给自 ...
- 能ping通虚拟机中的Ubuntu,使用XShell连不上
1.在宿主机上telnet 虚拟机ip 22如果显示端口无法接通,说明你的/etc/init.d/sshd 是stop或者是异常的. 2.如果没有sshd服务,使用" sudo apt-g ...
- 【调试工具】tcpdump
[tcpdump]https://linux.cn/article-10191-1.html
- 【linux】Python3.6安装报错 configure: error: no acceptable C compiler found in $PATH
安装python的时候出现如下的错误: [root@master ~]#./configure --prefix=/usr/local/python3.6 checking build system ...
- v-for 在 VSCode 中出现 Elements in iteration expect to have 'v-bind:key' directives.
在 VSCode 中编辑代码时,在有 v-for 的语句下面有一条红色波浪线,鼠标放上去有提示 Elements in iteration expect to have 'v-bind:key' di ...
- CentOS7防火墙问题
CentOS6关闭防火墙使用以下命令, //临时关闭service iptables stop//禁止开机启动chkconfig iptables off CentOS7中若使用同样的命令会报错, s ...
- MySQL架构备份
MySQL Replication 概述 集群的主要类型? 高可用集群(High Available Cluster, HA) 高可用集群是指通过特殊的软件把独立的服务器连接起来,组成一个能够提供故障 ...
- Docke--Dockerfile实践
Dockerfile 实践 nginx镜像构建 先查看下本地的镜像,选取官网的centos作为base image: [root@server ~]# docker images REPOSITORY ...
- FTP文件上传并支持断点续传(一)—— win10 本地环境 ftp站点构建
由于之前项目开发是采用是采用的FTP文件上传,就一直想学习,但由于FTP服务器是公司的,为了方便就像把本地变成ftp站点,其实很简单,但也有很多坑 这里简单介绍一下自己遇到的坑 一:开通本地的ftp权 ...