アットウィキロゴ

p9996

package movie;
 
import java.io.*;
 
 
public class pro {
 
    int s,datanumber;
    String[] data=new String[500000];
   String[] dic=new String[5000];
     String[] code=new String[5000];
        String[] name=new String[500000];
     int number;
    String[] id=new String[5000];
    int[] point=new int[5000000];
 
 
    public static void main(String[] args) {
       pro te=new pro();
    }
 
    pro(){
 
 
 
 
        dic sub52=new dic();
        sub52.makedata();
        dic=sub52.dic;
        number=sub52.number;
        code=sub52.code;
 
 
        readx("movie.csv");
 
 
        for(s=1;s<datanumber;s++){
         String[] x=data[s+1].split(",");
         name[s]=x[5];  
         point[s]=numx(x[6]);
        }
 
 
  for(s=1;s<datanumber+1;s++){
    String str=sub52.rev(name[s]);  
   id[s]=sub52.check(str);
if(id[s].length()<1)id[s]= sub52.search(str);
    System.out.println(name[s]+","+id[s]);
    }       
 
 
 
 
 
 
 
 
 
    }
 
 
 
    void readx(String file){
 
String str;
BufferedReader br;  
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}  
 
datanumber=s;
 
} 
 
 
       int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
}
 
 
 
package movie;
 
 
import tool.*;
 
public class dic {
 
    int s,datanumber;
  String[] data=new String[5000];
  String[] dic=new String[5000];
  String[] code=new String[5000];
    int number;
 
 
 
    void makedata(){
 
 
        readfile sub52=new readfile();
        sub52.makedata("data.csv","UTF-8");
        data=sub52.data;
        datanumber=sub52.datanumber;
 
        for(s=1;s<datanumber;s++){
         String[] x=data[s+1].split(",");
         dic[s]=x[1];   
         code[s]=x[2];
 
        }
 
        number=datanumber-1;
 
 
 
}
 
 String check(String word){
        String w1="";
        int s;
        for(s=1;s<number;s++){
        if(word.equals(dic[s]))w1=code[s];    
        }
 
        return w1;
    }
 
 String search(String word){
 
 
         String[] name=new String[5000];
      String[] id=new String[5000];
 
     makeutf sub6=new makeutf();
        String d=sub6.makedata(word);
 
 
 
        String urlx="http://movie.walkerplus.com/search/free_search.cgi?comkind=movie&keyword="+d;
 
         getdata sub7=new getdata();
        sub7.makedata(urlx,"UTF-8");
        data=sub7.data;
        datanumber=sub7.datanumber; 
 
        int sx=0;
        for(s=1;s<datanumber+1;s++){
            int h=0; 
            if(data[s].indexOf("com/mv")>-1)h=h+1;
            if(data[s].indexOf("</h5>")>-1)h=h+1;
            if(h==2)    sx=sx+1;
        if(h==2)name[sx]=data[s];
 
        }
 
   int number=sx;
 
 
         for(s=1;s<number+1;s++){
         int p1=name[s].indexOf("mv");
         int p2=name[s].indexOf("/",p1);
         id[s]=name[s].substring(p1,p2);
         p1=name[s].indexOf(">",p1);
         p2=name[s].indexOf("<",p1+1);
         name[s]=name[s].substring(p1+1,p2);
 
          }
 
         String w1="";
         if(number>0)w1=id[1];
 
    return w1;
 
 
}
 String rev(String strx){
  int p1=strx.indexOf("(");
        if(p1>-1)strx=strx.substring(0,p1);
 
 p1=strx.indexOf("【");
        if(p1>-1)strx=strx.substring(0,p1); 
 return strx;
}}
 
最終更新:2016年07月24日 19:14