アットウィキロゴ

おしえてく

package card;
import tool.*;
import java.io.*;
 
 
public class pro {
 
   int s,datanumber;
   String[] data=new String[5000];
   int[] a=new int[210];
   int[] b=new int[210];
    int number;
   String[] link=new String[5000];
 
 
     String[] credit=new String[5000];
    String[] name=new String[5000];
  String[] title=new String[5000];
 
    public static void main(String[] args) {
       pro t=new pro();
    }
 
    pro(){
 
        int k;
 
        String uu="";
        uu="<FONT color=\"#ffffff\">| <a href=\"1st.htm\" title=\"第1回日プロ大賞\">第1 回</a> | <a href=\"2nd.htm\" title=\"第2回日プロ大賞\">第2 回</a> | <a href=\"3rd.htm\" title=\"第3回日プロ大賞\">第3 回</a> | <a href=\"4th.htm\" title=\"第4回日プロ大賞\">第4 回</a> | 第5 回 | <a href=\"6th.htm\" title=\"第6回日プロ大賞\">第6 回</a> | <a href=\"7th.htm\" title=\"第7回日プロ大賞\">第7 回</a> | <a href=\"8th.htm\" title=\"第8回日プロ大賞\">第8 回</a> | <a href=\"9th.htm\" title=\"第9回日プロ大賞\">第9 回</a> | <a href=\"10th.htm\" title=\"第10回日プロ大賞\">第10回</a> |<BR>";
  uu=uu+"</FONT><FONT color=\"#ffffff\">| <a href=\"11th.htm\" title=\"第11回日プロ大賞\">第11回</a> | <a href=\"12th.htm\" title=\"第12回日プロ大賞\">第12回</a> | <a href=\"13th.htm\" title=\"第13回日プロ大賞\">第13回</a> | <a href=\"14th.htm\" title=\"第14回日プロ大賞\">第14回</a> | <a href=\"15th.htm\" title=\"第15回日プロ大賞\">第15回</a> | <a href=\"16th.htm\" title=\"第16回日プロ大賞\">第16回</a> | <a href=\"17th.htm\" title=\"第17回日プロ大賞\">第17回</a> | <a href=\"18th.htm\" title=\"第18回日プロ大賞\">第18回</a> | <a href=\"19th.htm\" title=\"第19回日プロ大賞\">第19回</a> | <a href=\"20th.htm\" title=\"第20回日プロ大賞\">第20回</a> |<BR>";
  uu=uu+"</FONT><FONT color=\"#ffffff\">| <a href=\"21st.htm\" title=\"第21回日プロ大賞\">第21回</a> | <a href=\"22nd.htm\" title=\"第22回日プロ大賞\">第22回</a> | <a href=\"23rd.htm\" title=\"第23回日プロ大賞\">第23回</a> | <a href=\"24th.htm\" title=\"第24回日プロ大賞\">第24回</a> | <a href=\"index.htm\" title=\"第25回日プロ大賞\">第25回</a>";
 
 
  String[] x1=uu.split(">");
  int sx=0;
  for(s=0;s<x1.length;s++){
  if(x1[s].indexOf("htm")>-1)sx=sx+1;
  if(x1[s].indexOf("htm")>-1)link[sx]=x1[s];
   }
 
  for(s=1;s<sx+1;s++){
  int p1=link[s].indexOf("\"");
   int p2=link[s].indexOf("\"",p1+1);
   link[s]=link[s].substring(p1+1,p2);   
    }
 
 
  int de=sx;
 
 
 for(k=1;k<de+1;k++){
 
     getdata sub2=new getdata();
        sub2.makedata("http://nichi-pro.filmcity.jp/"+link[k],"SJIS");
        data=sub2.data;
        datanumber=sub2.datanumber;     
 
        sx=0;
        for(s=2;s<datanumber+1;s++){
      if(data[s].indexOf("<TAB")>-1)sx=sx+1;
       if(data[s].indexOf("<TAB")>-1)a[sx]=s;
 
        }
 
        sx=0;
          for(s=2;s<datanumber+1;s++){
      if(data[s].indexOf("</TAB")>-1)sx=sx+1;
       if(data[s].indexOf("</TAB")>-1)b[sx]=s;
 
        }
 
          int n=sx;
     String pp="";
 
       for(s=1;s<n+1;s++){
        String str="";
     for(sx=a[s];sx<b[s]+1;sx++){   
      str=str+data[sx];
 
    }
 
     if(str.indexOf(">主演女優賞")>-1)pp=str;
    }
 
       pp=pp.replace("tr","TR");
           pp=pp.replace("td","TD");
       String[] x=pp.split("</TR>");
 
       for(s=1;s<x.length;s++){  
        String[] y=x[s].split("</TD>");  
       credit[s]="";
       name[s]="";
       title[s]="";
        for(sx=0;sx<y.length;sx++){
       if(sx==0)credit[s]=change(y[sx]);
       if(sx==1)name[s]=change(y[sx]); 
       if(sx==2)title[s]=change(y[sx]); 
        }
       System.out.println(title[s]);
       }
 
       number=x.length-1;
 
 
    writexml("data/"+k+".txt");
    }
 
 
    }   
 
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.println(credit[s]+"△"+name[s]+"△"+title[s]); 
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
   String change(String str){
 
        int n;
        for(n=1;n<25;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年12月14日 04:09