package wiki;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[6000];
String[] subdata=new String[6000];
int[] point=new int[6000];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
String word="松井玲奈";
makeutf sub6=new makeutf();
String d=sub6.makedata(word);
String urlx="https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/ja.wikipedia/all-access/user/"+d+"/daily/2016010100/2016073100";
getdata sub7=new getdata();
sub7.makedata(urlx,"UTF-8");
data=sub7.data;
datanumber=sub7.datanumber;
String str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}
String[] x=str.split(",");
int sx=0;
for(s=0;s<x.length;s++){
if(x[s].indexOf("views")>-1)sx=sx+1;
if(x[s].indexOf("views")>-1)subdata[sx]=x[s];
}
int number=sx;
for(s=1;s<number+1;s++){
int p1=subdata[s].indexOf(":");
int p2=subdata[s].indexOf("}",p1);
String strx=subdata[s].substring(p1+1,p2);
point[s]=numx(strx);
}
int px=0;
for(s=1;s<number+1;s++){
px=px+point[s];
}
px=px/number;
System.out.println(px);
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年08月15日 11:57