import java.io.*;
class data{
String urlx,bun;
String[] data=new String[5000];
String[] link=new String[5000];
String[] credit=new String[5000];
int[] x=new int[5000];
int[] y=new int[5000];
int s,datanumber,xmlnumber;
int p1,p2,s1,s2,j;
String rv,str,point,author,title;
int n;
public static void main(String [] args) {
data test=new data();
}
data(){
readfile("link.txt");
for(n=1;n<101;n++){
link[1]=data[n];
urlx=link[1];
getdata gt=new getdata();
gt.makedata(urlx);
bun=gt.data;
p1=bun.indexOf("<p>");
p2=bun.indexOf("</p>",p1);
rv=bun.substring(p1+3,p2);
rv=rv.replace("<br />","");
System.out.println(rv);
xymaker(bun);
for(s=1;s<xmlnumber;s++){
str=bun.substring(x[s],y[s]);
if(str.indexOf("点")>1)point=str;
}
p1=point.indexOf("alt");
p2=point.indexOf("点",p1);
point=point.substring(p1+5,p2);
System.out.println(point);
p1=bun.indexOf("commonPostInfo");
p2=bun.indexOf("f_delbbs",p1);
author=bun.substring(p1,p2);
j=0;
if(author.indexOf("未登録")>0)j=100;
if(j<50)makeauthor();
if(j>50)nonau();
for(s=1;s<50;s++){
str=bun.substring(x[s],y[s]);
if(str.equals("<title"))s1=s;
if(str.equals("</title"))s2=s;
}
title=bun.substring(y[s1],x[s2]);
p1=title.indexOf("」");
p2=title.indexOf("@");
title=title.substring(p1+1,p2);
System.out.println(title);
}
}
void nonau(){
int p1,p2;
p1=author.indexOf("未登録");
p1=author.indexOf(">",p1);
p2=author.indexOf("<",p1);
author=author.substring(p1+1,p2);
System.out.println(author);
}
void makeauthor(){
String[] z=author.split(">");
for(s=1;s<z.length;s++){
if(z[s].indexOf("</a")>0)author=z[s];
}
author=author.replace("</a","");
System.out.println(author);
}
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 readfile(String file){
String str;
BufferedReader br;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2011年06月30日 12:42