アットウィキロゴ

0009

package act;
 
 
import tool.*;
 
public class pro {
 String[] code=new String[50000];
     String[] codex=new String[50000];
  int[] point=new int[5000];
     String[] name=new String[50000];
      String[] data=new String[50000];
    int s,sx,datanumber;
    String[] t=new String[5000];
 
      int[] number_dic=new int[5000];
      int[] y=new int[5000];
 
      int[] v1=new int[5000];
   double[] p=new double[5000];
   double[] sol=new double[50];
 int number;
 double[][] x=new double[700][60];
 
    public static void main(String[] args) {
        pro te=new pro();
    }
    pro(){
 
    readfile sub=new readfile();
    sub.makedata("200.txt","SJIS");
    datanumber=sub.datanumber;
    data=sub.data;
 
        int sx=0;
    for(s=1;s<datanumber+1;s++){
  String[] x=data[s].split(",");
if(x.length>1){ 
    sx=sx+1;
    name[sx]=x[0]; 
    code[sx]=x[1];
   System.out.println(name[sx]+","+code[sx]);
}    
}
 
 
 
 
    datanumber=sx;
 
     for(s=1;s<datanumber+1;s++){
    age sub2=new age();
    sub2.makedata(code[s]);
     }
 
    }
 
    double num(String str){
 
    double nx;
 
    nx=0;
 
 try{
 
    nx=Double.parseDouble(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
      int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
 
 
}
 
 
 
package act;
 
import tool.getdata;
 import java.io.*;
 
public class age {
 
     int s,datanumber;
    String[] data=new String[6000];
   String[] credit=new String[6000];
      String[] name=new String[6000];
   int number;
 
   void makedata(String gid){
 
 
           String urlx="http://www.oricon.co.jp/prof/";
           urlx=urlx+gid+"/profile/";
 
 
        getdata sub7=new getdata();
        sub7.makedata(urlx,"SJIS");
        data=sub7.data;
        datanumber=sub7.datanumber; 
 
       int s1=0;
     for(s=1;s<datanumber+1;s++){
     if(data[s].indexOf("<div class=\"box-artist\">")>-1)s1=s;
     }
 
     int s2=s1;
     for(s=s1+1;s<datanumber+1;s++){
     if(data[s].indexOf("<!--/.box-artist-profile-->")>-1)s2=s;
     }
 
     String str="";           
    for(s=s1;s<s2;s++){
    str=str+data[s];
 
    }
 
    String[] x=str.split("</tr>");
    int sx=0;
    for(s=0;s<x.length-1;s++){
    sx=sx+1;
        int p1=x[s].indexOf("<td");
    int p2=x[s].indexOf("</td",p1);
    String strx="";
    if(p1>-1)strx=x[s].substring(p1,p2);
   name[sx]= change(strx);  
    p1=x[s].indexOf("<th");
    p2=x[s].indexOf("</th",p1);
    strx="";
    if(p1>-1)strx=x[s].substring(p1,p2);
    credit[sx]=change(strx);
    }
 
   number=sx;
 
 
   writexml("data/"+gid+".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.print(credit[s]); 
     pw.print(",");
    pw.println(name[s]); 
}
 
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
 String change(String str){
 
        int n;
        for(n=1;n<11;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年08月26日 13:08