package hou;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] name=new String[50000];
String[] city=new String[50000];
String[] party=new String[50000];
int[] point=new int[500000];
int number_city=0;
int number;
String[] town=new String[5000];
String[] code=new String[50000];
String[] v=new String[50000];
String[][] vs=new String[200][500];
int dicnumber=0;
String[] link=new String[500];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
getdata sub=new getdata();
sub.makedata("http://geireki.tvshowdatabase.com/geinin/geirekigeinin.html","SJIS");
data=sub.data;
datanumber=sub.datanumber;
String str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}
String a="<div class=\"gprofile\">";
String[] x=str.split(a);
int sx;
for(s=1;s<x.length-1;s++){
String[] y=x[s].split("</span>");
name[s]="";
code[s]="";
city[s]="";
for(sx=0;sx<y.length;sx++){
if(sx==1)name[s]=change(y[sx]);
if(sx==2)code[s]=change(y[sx]);
if(sx==3)city[s]=change(y[sx]);
if(sx==4)town[s]=change(y[sx]);
if(sx==5)party[s]=change(y[sx]);
}
if(name[s].length()>0) System.out.println(name[s]+","+code[s]+","+city[s]+","+town[s]+","+party[s]);
}
}
String change(String str){
int n;
for(n=1;n<15;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;
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<number-1;s++){
pw.print(name[s]);
pw.print(",");
pw.print(link[s]);
pw.print(",");
pw.print(city[s]);
pw.print(",");
pw.print(code[s]);
pw.print(",");
pw.print(town[s]);
pw.print(",");
pw.println(v[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
double num(String str){
double nx;
nx=0;
try{
nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年08月22日 14:19