package shin;
import tool.*;
import epub2.epub_kadokawa;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] subdata=new String[5000];
int numberx;
String titlex;
String[] link=new String[5000];
int number;
String[] subtitle=new String[250];
String[][] page=new String[200][50000];
String[] subx=new String[50000];
String title,author;
int[] subnumber=new int[200];
int year,month,day;
public static void main(String[] args) {
pro te=new pro();
}
pro(){
int sx=0;
int p;
for(p=2;p<4;p++){
String urlx="http://www.dailyshincho.jp/dom/pol/page/"+p+"/";
getdata sub2=new getdata();
sub2.makedata(urlx,"UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
for(s=1;s<datanumber+1;s++){
int h=0;
if(data[s].indexOf("http://www.dailyshincho.jp/article")>-1)h=h+1;
if(data[s].indexOf("<dl>")>-1)h=h+1;
if(h==2)sx=sx+1;
if(h==2)link[sx]=data[s];
}
}
int k=sx;
for(s=1;s<k+1;s++){
int p1=link[s].indexOf("http");
int p2=link[s].indexOf("\"",p1);
link[s]=link[s].substring(p1,p2);
}
number=k;
for(s=1;s<number+1;s++){
String urlx=link[s]+"?all=1";
file sub=new file();
sub.makedata(urlx);
subdata=sub.subdata;
numberx=sub.number;
subtitle[s]=sub.title;
for(sx=1;sx<numberx+1;sx++){
page[s][sx]=subdata[sx];
}
subnumber[s]=numberx;
}
title="週刊新潮の政治記事";
author="週刊新潮";
year=28;
month=11;
day=26;
epub_kadokawa sub18=new epub_kadokawa();
sub18.page=page;
sub18.number=number;
sub18.subnumber=subnumber;
sub18.subtitle=subtitle;
sub18.title=title;
sub18.author=author;
sub18.year=year;
sub18.month=month;
sub18.day=day;
sub18.makedata(title+".kepub.epub");
}
}
package shin;
import tool.*;
public class file{
int s,datanumber;
String[] data=new String[5000];
String[] subdata=new String[5000];
int number;
String title;
void makedata(String urlx){
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
String str1="wp_txt";
int s1=0;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf(str1)>-1)s1=s;
}
int h;
int s2=0;
for(s=s1+1;s<datanumber+1;s++){
h=0;
if(data[s].indexOf("</div>")>-1)h=h+1;
if(s2==0)h=h+1;
if(h==2)s2=s;
}
int sx=0;
for(s=s1+1;s<s2;s++){
sx=sx+1;
subdata[sx]=change(data[s]);
}
number=sx;
String str2="<h2 class=\"typ1\">国内</h2>";
s1=0;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf(str2)>-1)s1=s;
}
s2=0;
for(s=s1+1;s<datanumber+1;s++){
h=0;
if(data[s].indexOf("<h3>")>-1)h=h+1;
if(s2==0)h=h+1;
if(h==2)s2=s;
}
title=change(data[s2]);
}
String change(String str){
int n;
for(n=1;n<11;n++){
str=rev(str);
}
str=str.replace(" ","");
return str;
}
String rev(String str){
if(str==null)str="";
int p1=str.indexOf("<");
int p2=str.indexOf(">",p1);
String strx="";
int h=0;
if(p1>-1)h=h+1;
if(p2>-1)h=h+1;
if(h==2)strx=str.substring(p1,p2+1);
str=str.replace(strx,"");
return str;
}
}
最終更新:2016年11月27日 23:29