アットウィキロゴ

datr

package den;
 
import tool.*;
import java.io.*;
 
public class pro {
 
 
        int s,datanumber;
    String[] data=new String[5000];
    String[] subdata=new String[5000];
  String[] sta=new String[5000];
 
   String[] tv=new String[5000];
   String[] title=new String[5000];
   String[] rate=new String[5000];
   int number; 
 
    public static void main(String[] args) {
        pro t=new pro();
    }
 
    pro(){
 
        int tr;
        for(tr=1;tr<1570;tr++){
 
          readfile sub2=new readfile();
        sub2.makedata("data/"+tr+".txt","UTF-8");
        data=sub2.data;
        datanumber=sub2.datanumber;
 
        String s1="entry_body";
        String s2="<div";
 
 
        String str="";
        for(s=1;s<datanumber+1;s++){
        str=str+data[s];
 
            }
 
        int p1=str.indexOf(s1);
        p1=str.indexOf(">",p1);
         int p2=str.indexOf(s2,p1);
        str=str.substring(p1+1,p2);
 
        str=str.replace("<br />", "△");
 
        String[] x=str.split("△");
 
        int sx=0;
        for(s=0;s<x.length;s++){
        x[s]=x[s].trim();
        x[s]=x[s].replace("%","%○");
        sx=sx+1;
        subdata[sx]=x[s];
 
        }
     number=sx;
 
     sta[0]="";
for(s=1;s<number+1;s++){          
 sta[s]="";
 int h=0;
if(subdata[s].indexOf("【")>-1)h=h+1;
 if(subdata[s].indexOf("○")>-1)h=0;
if(h==1)sta[s]=subdata[s];
if(sta[s].length()<1)sta[s]=sta[s-1];
 
}
 
 
 
  sx=0;      
for(s=1;s<number+1;s++){   
if(subdata[s].indexOf("○")>-1)sx=sx+1;
if(subdata[s].indexOf("○")>-1)tv[sx]=sta[s];
String[] y=subdata[s].split("○");
if(y.length>1)rate[sx]=y[0];
if(y.length>1)title[sx]=y[1];
    }
       number=sx; 
for(s=1;s<number+1;s++){
 
    }
 
 
 
        writexml("gdata/"+tr+".txt");
        }
 
 
 
    }
 
 
 
     void writexml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=1;s<number+1;s++){    
pw.print(tv[s]); 
pw.print(",");  
pw.print(rate[s]); 
pw.print(","); 
pw.println(title[s]);
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
 
}
 
最終更新:2016年07月12日 06:54