アットウィキロゴ

てつこ9

package d3;
 
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import tool.*;
import java.util.HashMap;
 
public class pro {
 
    HashMap<String,String> map = new HashMap<String,String>();  
 
  int s,datanumber;
    String[] data=new String[400000];
    String[] name=new String[400000];
     String[] code=new String[400000];
      String[] codex=new String[40000];
 int delta;
    public static void main(String[] args) {
        pro r=new pro();
    }
    pro(){
 
 
        readfile sub7=new readfile();
        sub7.makedata("SJIS.csv","UTF-8");
        data=sub7.data;
        datanumber=sub7.datanumber; 
 
        for(s=2;s<datanumber+1;s++){
        String[] x=data[s].split(",");
       String str="%"+x[2]+"%"+x[1];
        map.put(x[0],str);
        }
 
 
 
        readx("tetu.csv");
 
        delta=datanumber;
 
        for(s=2;s<delta+1;s++){
        String[] x=data[s].split(",");
        name[s-1]="";
        if(x.length>0)name[s-1]=x[3];;
        }
 
        int tr=1;
 
 
 
  for(s=1;s<delta;s++){
 
 
 
      oricon sub3=new oricon();
  sub3.map=map;
  code[s]=sub3.makedata(name[s]);
  System.out.println(name[s]+","+code[s]);
  try{
  Thread.sleep(100); 
}catch(InterruptedException e){}
 
 
  }
 
    for(s=1;s<delta;s++){
  if(code[s].length()<1){
  bing sub4=new bing();
  code[s]=sub4.makedata(name[s]);
 
  }  
  }
 
    for(s=1;s<delta;s++){
   System.out.println(name[s]+","+code[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;
 
} 
 
 
}
 
 
package d3;
 
import tool.*;
import java.util.HashMap;
 
public class oricon {
 
    int s,datanumber;
String[] data=new String[5000];
  String[] subdata=new String[5000];
  String[] memo=new String[5000];
HashMap<String,String> map = new HashMap<String,String>();  
 
 
 
    String makedata(String w3){
 
 
 
        String w=makeword(w3);
 
  String urlx="http://www.oricon.co.jp/search/result.php?types=artist&search_string="+w+"&x=0&y=0";
 
 
        getdata sub6=new getdata();
        sub6.makedata(urlx,"SJIS");
        data=sub6.data;
        datanumber=sub6.datanumber;  
 
 
        int sx=0;
        for(s=1;s<datanumber+1;s++){
         int h=0;
         if(data[s].indexOf("/prof/")>-1)h=h+1;
          if(data[s].indexOf("ランキング")<1)h=h+1;
              if(h==2)  sx=sx+1;
           if(h==2)memo[sx]=data[s];
 
        }
 
 
         for(s=1;s<sx+1;s++){
     int p1=memo[s].indexOf("/prof/");
      int p2=memo[s].indexOf("\"",p1);
      memo[s]=memo[s].substring(p1,p2);
 
    }
 
        String id="";
            if(sx>0)id=memo[1];
 
 
 
 return id;
 
    }
    String search(String ch){
 
       String w1="";
        if(map.containsKey(ch))w1=map.get(ch);
 
        return w1;
 
 
    }
 
      String makeword(String ww){
 
          int s;
       String k="";
          for(s=0;s<ww.length();s++){
       String d1=ww.substring(s,s+1);
       k=k+search(d1);
       }
 
        return k;
 
 
    }
}
 
 
package d3;
 
import tool.*;
 
public class bing {
 
    int s,datanumber;
    String[] data=new String[6000];
 
 
 
 
    String makedata(String wordx){
 
        String word="オリコン芸能人事典"+" "+wordx;
 
        makeutf sub6=new makeutf();
        String d=sub6.makedata(word);
 
 
           String urlx="https://www.bing.com/search?q=";
           urlx=urlx+d;
 
 
        getdata sub7=new getdata();
        sub7.makedata(urlx,"UTF-8");
        data=sub7.data;
        datanumber=sub7.datanumber; 
 
        String ss="aria-label=\"検索結果";
 
        String str="";
 
        for(s=1;s<datanumber+1;s++){
 
        if(data[s].indexOf(ss)>-1)str=data[s];
 
        } 
 
        String[] x=str.split(">");
 
        String d2="http://www.oricon.co.jp/prof/artist/";
        String pp="";
 
     for(s=0;s<x.length;s++){   
     int h=0;
    if(x[s].indexOf(d2)>-1)h=h+1;
    if(pp.length()==0)h=h+1;
    if(h==2)pp=x[s];
    }
 
    int p1=pp.indexOf("prof/artist/");
    int p2=-1;
    if(p1>-1)p2=pp.indexOf("\"",p1);
    if(p2>-1)pp=pp.substring(p1,p2); 
 
 return pp; 
 
 
 
 
 
    }
 
 
}
 
最終更新:2016年08月12日 01:55