脚本,爬取文书网
控制台输入:
1 var startdata="2018-09-30"; 2 function getNextDay(d){ 3 d = new Date(d); 4 d = +d + 1000*60*60*24; 5 d = new Date(d); 6 7 var yy=d.getFullYear(); 8 var mm=d.getMonth()+1; 9 var dd=d.getDate(); 10 var nextday=yy+"-"; 11 if (mm<10){nextday+="0"} 12 nextday+=mm+"-"; 13 if(dd<10){nextday+="0"} 14 nextday+=dd; 15 return nextday; 16 17 } 18 function download(){ 19 var ids = []; 20 var i=0; 21 $('.ListSelect').each(function() { 22 ids.push($(this).attr("data-value")); 23 if((++i)%50==0) 24 { 25 window.open("https://wenshu.court.gov.cn/down/more?docIds="+ids.toString(),"_blank"); 26 ids=[]; 27 } 28 }); 29 $("#cprqStart").val(startdata); 30 $("#cprqEnd").val(startdata); 31 startdata=getNextDay(startdata); 32 $("#searchBtn").click(); 33 setTimeout("download_pre()","5000"); 34 } 35 function download_pre(){ 36 var id=($("select.pageSizeSelect").get(0).selectedIndex+1)%3 37 $("select.pageSizeSelect option").eq(id).html(500); 38 $('select.pageSizeSelect').val(500).trigger('change'); 39 setTimeout("download()","15000"); 40 } 41 download_pre();