package wiki2;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] credit=new String[5000];
String[] v=new String[5000];
public static void main(String[] args) {
pro r=new pro();
}
pro(){
String word="仙道敦子";
makeutf sub2=new makeutf();
String w1=sub2.makedata(word);
getdata sub=new getdata();
sub.makedata("https://ja.wikipedia.org/wiki/"+w1,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int s1=0;
for(s=1;s<datanumber+1;s++){
int h=0;
if(data[s].indexOf("infobox")>-1)h=h+1;
if(s1==0)h=h+1;
if(h==2)s1=s;
}
int s2=0;
if(s1==0)s1=99999999;
for(s=s1;s<datanumber+1;s++){
int h=0;
if(data[s].indexOf("</tab")>-1)h=h+1;
if(s2==0)h=h+1;
if(h==2)s2=s;
}
String str="";
for(s=s1;s<s2;s++){
str=str+data[s];
}
String[] x=str.split("</tr>");
for(s=0;s<x.length;s++){
x[s]=x[s].replace("</th>","△");
x[s]=x[s].replace("</td>","△");
String[] y=x[s].split("△");
credit[s]=change(y[0]);
v[s]="";
if(y.length>1)v[s]=change(y[1]);
System.out.println(credit[s]+","+v[s]);
}
}
String change(String str){
int n;
for(n=1;n<21;n++){
str=rev(str);
}
str=str.replace(" ","");
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年07月31日 02:50