class pro{
String data,urlx,z,key;
int[] x=new int[10000];
int[] y=new int[10000];
int[] tsecode=new int[2000];
String[] xml=new String[10000];
int s,xmlnumber;
int n,h;
int code;
String date,content,title;
public static void main(String [] args) {
pro test=new pro();
}
pro(){
getcode gc=new getcode();
gc.makedata();
tsecode=gc.tsecode;
code=tsecode[950];
urlx="http://messages.yahoo.co.jp/bbs?action=q&board=";
urlx=urlx+code;
getdata gt=new getdata();
gt.makedata(urlx);
data=gt.data;
xymaker(data);
xmlmaker(data);
key=catchkey();
for(n=45;n<55;n++){
urlx=yahoo(code,n,key);
gt.makedata(urlx);
data=gt.data;
makedata(data);
System.out.println(title);
System.out.println(date);
System.out.println(content);
}
}
String catchkey(){
int s,h,p3,p4;
String key,z,str1,str2,str3,str4;
str1="bbs";
str2="action=m";
z="";
for(s=1;s<xmlnumber-10;s++){
h=0;
if(xml[s].indexOf(str1)>0)h=h+1;
if(xml[s].indexOf(str2)>0)h=h+1;
if(h==2)z=xml[s];
}
str3="tid=";
str4="&sid";
p3=z.indexOf(str3);
p4=z.indexOf(str4);
key=z.substring(p3,p4);
return key;
}
String yahoo(int code,int num,String key){
int ycode;
String urlx;
ycode=1000000+code;
urlx="http://messages.yahoo.co.jp/bbs?.mm=FN&action=m&board=";
urlx=urlx+ycode;
urlx=urlx+"&";
urlx=urlx+key;
urlx=urlx+"&sid=";
urlx=urlx+ycode;
urlx=urlx+"&mid=";
urlx=urlx+num;
return urlx;
}
void xmlmaker(String str){
int s,p1,p2;
for(s=1;s<xmlnumber-10;s++){
p1=x[s];
p2=y[s];
xml[s]=str.substring(p1+1,p2);
}
}
void xymaker(String str){
int p1;
int s;
s=1;
p1=str.indexOf("<");
x[1]=p1;
while(p1>-1){
p1=str.indexOf("<",p1+1);
if(p1>-1)s=s+1;
if(p1>-1)x[s]=p1;
}
xmlnumber=s;
for(s=1;s<xmlnumber+1;s++){
y[s]=str.indexOf(">",x[s]);
}
}
void makedata(String data){
int sx,h,p1,p2;
String bun,z1,z2;
String str1,str2;
String[] z=new String[100];
title="";
date="";
content="";
str1="<!--// MESSAGE -->";
str2="<!--// /MESSAGE -->";
p1=data.indexOf(str1);
p2=data.indexOf(str2);
h=0;
if(p1<1)h=100;
if(p2<1)h=100;
while(h<50){
bun=data.substring(p1,p2);
xymaker(bun);
z2="";
for(s=1;s<xmlnumber-1;s++){
p1=y[s];
p2=x[s+1];
z1=bun.substring(p1+1,p2);
if(z1.length()>0)z2=z1;
}
content=z2;
str1="<!--// MAIN TOPIC -->";
str2="<!--// USER -->";
p1=data.indexOf(str1);
p2=data.indexOf(str2);
bun=data.substring(p1,p2);
xymaker(bun);
z2="";
sx=0;
for(s=1;s<xmlnumber-1;s++){
p1=y[s];
p2=x[s+1];
z1=bun.substring(p1+1,p2);
if(z1.length()>0)sx=sx+1;
if(z1.length()>0)z[sx]=z1;
}
title=z[1];
date=z[2];
h=100;
}
}
}
最終更新:2011年04月18日 21:52