アットウィキロゴ

xxs

import java.net.*;  
import java.io.*;

class bloginput{

String bun;
String[] article=new String[1000];
String[] title=new String[1000];  
String[] des=new String[1000];
int s;

int articlenumber;

void makedata(String urlx){

getdata(urlx);

makearticle();

for(s=1;s<articlenumber+1;s++){
title[s]=makeitem(article[s],"title");  
des[s]=makeitem(article[s],"description");
}


for(s=1;s<articlenumber+1;s++){
des[s]=rev(des[s]);
}



}

String rev(String str){
String z;
int sx,nx;
int pop;
z=str;
pop=str.indexOf("&lt");
while(pop>-1){
String[] x=str.split("&lt");
z="";
for (sx=0;sx<x.length;sx++){
String[] y=x[sx].split("&gt;");
for (nx=1;nx<y.length;nx++){
z=z+y[nx];
}
}
pop=-100;
}
return z;
}


String makeitem(String str,String cc){
int x1,x2,x3;
String x4;
String str1,str2;
str1="<" + cc + ">";
str2="</" + cc + ">";
x1=str.lastIndexOf(str1);
x3=str1.length();
x2=str.indexOf(str2);
x4=str.substring(x1+x3,x2);
return x4;
}

void makearticle(){
int s;
String[] x=bun.split("<item>");

articlenumber=x.length-1;

for (s=1;s<articlenumber+1;s++){
String[] y=x[s].split("</item>");
article[s]=y[0];
}

}

void getdata(String urlx){  
int n;
String data[]=new String[1000];
int getnumber;

getnumber=0;

try{
        URL url = new URL(urlx);

        HttpURLConnection con = (HttpURLConnection)url.openConnection();
        con.setRequestMethod("GET");
        con.connect();

BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream(),"UTF-8"));
n=0;
while (true){
String line = reader.readLine();
if ( line == null ){ break; }
data[n]=line;
n=n+1;
getnumber=n;
        }
        reader.close();
        con.disconnect();
}
catch(Exception e) { System.err.println(e); }  

bun="";
for(n=0;n<getnumber;n++){
bun=bun+data[n];
}


}

}
最終更新:2011年03月31日 00:08