package oricon;
import tool.*;
public class pro {
int s,datanumber,subnumber,sx;
String[] data=new String[50000];
String[] artist=new String[50000];
String file;
String[] subdata=new String[50000];
String[] name=new String[50000];
String[] yahoo=new String[50000];
String[] id=new String[50000];
public static void main(String[] args) {
pro test=new pro();
}
pro(){
file="data.txt";
readfile sub=new readfile();
sub.makedata(file,"UTF-8");
datanumber=sub.datanumber;
data=sub.data;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
artist[s]=x[3];
System.out.println(artist[s]);
}
file="yahoo.csv";
readfile sub2=new readfile();
sub2.makedata(file,"UTF-8");
subnumber=sub2.datanumber;
subdata=sub2.data;
for(s=1;s<subnumber+1;s++){
String[] y=subdata[s].split(",");
name[s]=y[0];
yahoo[s]=y[1];
}
for(s=1;s<datanumber+1;s++){
id[s]="noname";
for(sx=1;sx<subnumber+1;sx++){
if(artist[s].equals(name[sx]))id[s]=yahoo[sx];
}
}
String[] code=new String[500];
int nn;
for(s=2;s<datanumber+1;s++){
if(id[s].equals("noname")){
yahoo sub4=new yahoo();
sub4.makedata(artist[s]);
code=sub4.yahoo;
nn=sub4.yahoonumber;
if(nn>0)id[s]=code[1];
}
}
for(s=1;s<datanumber+1;s++){
data[s]=data[s]+","+id[s];
}
writefile sub7=new writefile();
sub7.data=data;
sub7.datanumber=datanumber;
sub7.makedata("ren.txt");
}
}
package oricon;
import tool.getdata;
import java.io.*;
import java.net.URLEncoder;
public class yahoo {
String urlx;
int s,datanumber,number;
String[] data=new String[5000];
String[] article=new String[50];
String str1,str2,str3,str;
String[] credit=new String[50];
public String[] yahoo=new String[50];
int s1,s2;
public int yahoonumber;
String u;
public void makedata(String word){
u="";
try{
u = URLEncoder.encode(word,"utf-8");
}catch(Exception e) { System.err.println(e); }
urlx="http://talent.search.yahoo.co.jp/search?p="+u;
System.out.println(urlx);
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
datanumber=sub.datanumber;
data=sub.data;
str1="<div id=\"HS1m1\">";
str2="<!-- /HS1m1 -->";
str3="http://talent.yahoo.co.jp/pf/detail";
s1=1;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf(str1)>-1)s1=s;
}
s2=1;
for(s=s1;s<datanumber+1;s++){
if(data[s].indexOf(str2)>-1)s2=s;
}
int sx;
sx=0;
for(s=s1;s<s2;s++){
if(data[s].indexOf(str3)>-1)sx=sx+1;
if(data[s].indexOf(str3)>-1)article[sx]=data[s];
}
number=sx;
int p1,p2;
for(s=1;s<number+1;s++){
str=article[s];
p1=str.indexOf("pp");
p2=str.indexOf("\"",p1);
str=str.substring(p1,p2);
credit[s]=str;
}
int h;
yahoonumber=0;
for(s=1;s<number+1;s++){
h=0;
for(sx=1;sx<yahoonumber+1;sx++){
if(credit[s].equals(yahoo[sx]))h=100;
}
if(h<50)yahoonumber=yahoonumber+1;
if(h<50)yahoo[yahoonumber]=credit[s];
}
}
}
最終更新:2013年12月23日 16:52