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/,这种 ...
随机推荐
- Photoshop给河边婚片加上唯美的霞光
<点小图查看大图> 最终效果 1.打开原图素材大图,按Ctrl + Alt + 2 调出高光选区,按Ctrl + Shift + I 反选得到暗部选区,然后创建曲线调整图层,对RGB.红. ...
- laravel 定义翻译字符串
https://learnku.com/docs/laravel/5.6/localization/1376 // 全景链接$data['share_phone'] = trans('web.host ...
- VScode插件以及配置
Auto Rename Tag —— 自动同步修改标签 AutoFileName —— 自动补全路径提示 background —— 一个萌萌的插件,可以自己设置vsc的背景图 Bootstrap 3 ...
- HashMap源码解读(jdk1.8)
1.相关常量 默认初始化容量(大小) static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; 最大容量 static final int M ...
- codeforces463D
Gargari and Permutations CodeForces - 463D Gargari got bored to play with the bishops and now, after ...
- codeforces8A
Train and Peter CodeForces - 8A Peter likes to travel by train. He likes it so much that on the trai ...
- Leetcode 4
Array Easy 1. 268. Missing Number 先对数组求和,用 0 ~ n本该有的和减去当前sum得到缺失的数字. class Solution { public int mis ...
- 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 ...
- 超越村后端开发(2:新建models.py+xadmin的引入)
1.新建Model 1.users数据 1.在apps/users/models.py中: from datetime import datetime from django.db import mo ...
- java的三大特征:封装,继承和多态
有点递进关系,继承增加了代码的复用性,多态必须基于继承才可以实现. 一.封装 使用原因:当我们没有为类进行封装的时候,类中定义的属性可以被外界随意访问,这样容易造成一些合法性的问题.封装可以非常好的解 ...