package info;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] link=new String[5000];
String[] name=new String[5000];
int number;
int[] a=new int[50];
int[] b=new int[50];
String[] subdata=new String[5000];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
int de;
for(de=1;de<264;de++){
int number_link=0;
readfile sub4=new readfile();
sub4.makedata("data/"+de+".txt","UTF-8");
link=sub4.data;
number_link=sub4.datanumber;
for(s=1;s<number_link+1;s++){
String[] x=link[s].split(",");
name[s]=x[3];
link[s]="";
if(x.length>4)link[s]=x[4];
}
int tr=1;
for(tr=1;tr<number_link+1;tr++){
String urlx=link[tr];
getdata sub3=new getdata();
sub3.makedata(urlx,"UTF-8");
data=sub3.data;
datanumber=sub3.datanumber;
int sx=0;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf("infobox")>-1)sx=sx+1;
if(data[s].indexOf("infobox")>-1)a[sx]=s;
}
number=sx;
for(s=1;s<number+1;s++){
b[s]=0;
for(sx=a[s];sx<datanumber+1;sx++){
int h=0;
if(data[sx].indexOf("</table>")>-1)h=h+1;
if(b[s]==0)h=h+1;
if(h==2)b[s]=sx;
}
}
String str="";
for(s=1;s<number+1;s++){
for(sx=a[s];sx<b[s];sx++){
str=str+data[sx];
}
}
String[] x=str.split("</tr>");
sx=0;
for(s=1;s<x.length;s++){
x[s]=x[s].replace("</th>","△");
sx=sx+1;
subdata[sx]=change(x[s]);
}
datanumber=sx;
writefile sub=new writefile();
sub.datanumber=datanumber;
sub.data=subdata;
sub.makedata("gdata/"+name[tr]+".txt");
}
}
}
String change(String str){
int n;
for(n=1;n<31;n++){
str=rev(str);
}
return str;
}
String rev(String str){
if(str==null)str="";
int p1=str.indexOf("<");
int p2=str.indexOf(">",p1);
String strx="";
if(p2>-1)strx=str.substring(p1,p2+1);
str=str.replace(strx,"");
return str;
}
}
最終更新:2016年09月05日 00:58