package dic;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] link=new String[5000];
String[] namex=new String[5000];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
link[1]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%82%E8%A1%8C/";
link[2]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%8B%E8%A1%8C/";
link[3]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%95%E8%A1%8C/";
link[4]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%9F%E8%A1%8C/";
link[5]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%AA%E8%A1%8C/";
link[6]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%AF%E8%A1%8C/";
link[7]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%81%BE%E8%A1%8C/";
link[8]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%82%84%E8%A1%8C/";
link[9]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%82%89%E8%A1%8C/";
link[10]="https://www.pasonica.com/50%E9%9F%B3%E9%A0%86%E7%B4%A2%E5%BC%95-%E3%82%8F%E8%A1%8C/";
link[11]="";
int tr;
for(tr=1;tr<11;tr++){
String urlx=link[tr];
w sub2=new w();
sub2.makedata(urlx);
}
}
}
package dic;
import tool.*;
public class memo {
int s,datanumber;
String[] data=new String[5000];
String makedata(String urlx){
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int s1=0;
for(s=1;s<datanumber+1;s++){
int h=0;
if(data[s].indexOf("j-module n j-tex")>-1)h=h+1;
if(data[s].indexOf("<h2")>-1)h=h+1;
if(h==2)s1=s;
}
int s2=0;
for(s=s1+1;s<datanumber+1;s++){
int h=0;
if(data[s].indexOf("</div")>-1)h=h+1;
if(s2==0)h=h+1;
if(h==2)s2=s;
}
String str="";
if(s1>0){
for(s=s1;s<s2+1;s++){
str=str+data[s];
}
}
str=clean_str(str);
return str;
}
String clean_str(String str){
int m;
String strx=str;
for(m=1;m<30;m++){
strx=fresh(strx);
}
strx=strx.replace(" ","");
strx=strx.replace(" ","");
strx=strx.replace(";","");
return strx;
}
String fresh(String str){
int p1=str.indexOf("<");
int p2=str.indexOf(">",p1);
String sp="";
if(p1>-1)sp=str.substring(p1,p2+1);
String k=str.replace(sp,"");
return k;
}
}
package dic;
import tool.*;
public class w {
int s,datanumber;
String[] data=new String[5000];
String[] link=new String[5000];
String[] namex=new String[5000];
void makedata(String web){
getdata sub2=new getdata();
sub2.makedata(web,"UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
int sx=0;
for(s=1;s<datanumber+1;s++){
int j=0;
int h=0;
if(data[s].indexOf("<strong>")>-1)j=100;
if(data[s].indexOf("<b>")>-1)j=100;
if(j>50)h=h+1;
if(data[s].indexOf("title")>-1)h=h+1;
if(data[s].indexOf("順索引")>-1)h=0;
if(h==2)sx=sx+1;
if(h==2)link[sx]=data[s];
}
int number=sx;
for(s=1;s<number+1;s++){
int q1=link[s].indexOf("title=");
q1=link[s].indexOf("\"",q1);
int q2=link[s].indexOf("\"",q1+1);
namex[s]=link[s].substring(q1+1,q2);
int p1=link[s].indexOf("href=");
int p2=link[s].indexOf("\"",p1+10);
link[s]=link[s].substring(p1+6,p2);
}
for(s=1;s<number+1;s++){
String urlx="https://www.pasonica.com"+link[s];
memo sub=new memo();
String a=sub.makedata(urlx);
System.out.println(namex[s]+","+link[s]+","+a);
}
}
String clean_str(String str){
int m;
String strx=str;
for(m=1;m<15;m++){
strx=fresh(strx);
}
strx=strx.replace(" ","");
strx=strx.replace(" ","");
strx=strx.replace(";","");
return strx;
}
String fresh(String str){
int p1=str.indexOf("<");
int p2=str.indexOf(">",p1);
String sp="";
if(p1>-1)sp=str.substring(p1,p2+1);
String k=str.replace(sp,"");
return k;
}
}
最終更新:2017年12月28日 12:52