アットウィキロゴ

国会オ

import java.io.*;

class pro{

String urlx,data,file;
String[] page=new String[1000];
String[] link=new String[1000];
String[] fr=new String[1000];
int pagenumber,linknumber;
int s,sx,p1,p2;
String str1,str2;
int cx;

public static void main(String [] args) {
        pro test=new pro();
            }

pro(){

cx=96;

urlx="http://kokkai.ndl.go.jp/SENTAKU/syugiin/176/00";
urlx=urlx+cx;
urlx=urlx+"/mainb.html";

getdata g=new getdata();
g.makedata(urlx);
data=g.data;

xml x=new xml();
x.makedata(data);
pagenumber=x.pagenumber;
page=x.page;


linknumber=pagenumber/2;

for(s=1;s<linknumber+1;s++){
sx=2*s;
link[s]=page[sx];
}

str2=".html";
str1="./";

for(s=1;s<linknumber+1;s++){
p1=link[s].indexOf(str1);
p2=link[s].indexOf(str2);
fr[s]=link[s].substring(p1+1,p2-1);
}

for(s=1;s<linknumber+1;s++){

urlx="http://kokkai.ndl.go.jp/SENTAKU/syugiin/176/00";
urlx=urlx+cx;
urlx=urlx+"/";
urlx=urlx+fr[s];
urlx=urlx+"c.html";

g.makedata(urlx);
data=g.data;

System.out.println(data);

file="";
file=file+s;
file=file+".txt";

writefile(file);

}

}

void writefile(String file){

try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(file)));
                                              
pw.println(data);                                                                

System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }

}







}
最終更新:2011年06月25日 18:36