アットウィキロゴ

ぃんk00

package tvlink;
 
 
public class pro {
 
  int subnumber;
  String[] link=new String[5000];  
  String[] sublink=new String[5000];  
  int number;
    String[] title=new String[5000]; 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
    pro(){
 
 
 
        String urlx="https://ja.wikipedia.org/wiki/%E3%83%A2%E3%82%B7%E3%83%A2%E3%83%8E%E3%81%B5%E3%81%9F%E3%82%8A%E3%80%9C%E3%82%BF%E3%83%AC%E3%83%B3%E3%83%88%E3%81%8C%E2%80%9C%E3%81%8A%E3%81%9F%E3%82%81%E3%81%97%E5%90%8C%E5%B1%85%E7%94%9F%E6%B4%BB%E2%80%9D%E3%81%97%E3%81%A6%E3%81%BF%E3%81%BE%E3%81%97%E3%81%9F%E3%80%9C";
 
        link[1]=urlx;
        number=1;
        int tr=1;
        int mode=0;
        while(mode<50){
 
        link sub=new link();
        sub.makedata(link[tr],"フジ","水曜",22);
        sublink=sub.link;
        subnumber=sub.subnumber;
        title[tr]=sub.titlex;
 
                int s,sx;
        for(s=1;s<subnumber+1;s++){
        int h=0;
        for(sx=1;sx<number+1;sx++){
        if(sublink[s].equals(link[sx]))h=100;
        }
        if(h<50)number=number+1;
        if(h<50)link[number]=sublink[s];
        }
 
        System.out.println(title[tr]+","+link[tr]);
 
        tr=tr+1;
        if(tr>number)mode=100;
 
        }
 
    }
 
 
 
}
 
 
 
package tvlink;
 
import tool.getdata;
 
public class link {
 
 int s,datanumber;
 String[] data=new String[5000];
      String[] link=new String[5000];
      int[] a=new int[600];
       int[] b=new int[600];
       String[] tab=new String[5000];
      String[] tabx=new String[5000];
 
       String[] name=new String[5000];
      String[] web=new String[5000];
 
       String[] next=new String[50];
      String[] prev=new String[50];
      String[] link_p=new String[50];
      String[] link_prev=new String[50];
      String[] title=new String[50];
       String[] sta=new String[50];
      int number;
    String[] memo=new String[50];
 
      String[] smap=new String[50];
       String[] sublink_prev=new String[60];
       String[] name_p=new String[60];
       String[] name_prev=new String[60];
    int subnumber;
      String[] time=new String[60];
     String[] term=new String[60];
     String titlex;
    void makedata(String urlx,String sta,String week,int time_s){
 
 
 
 
        getdata sub17=new getdata();
        sub17.makedata(urlx,"UTF-8");
        data=sub17.data;
        datanumber=sub17.datanumber; 
 
 
        titlex="";
         for(s=1;s<datanumber+1;s++){
      if(data[s].indexOf("<title")>-1)titlex=data[s];
    }
 
         titlex=titlex.replace(" - Wikipedia</title>","");
          titlex=titlex.replace("<title>","");
 
 
 
        String str="";
        int sx=0;
        for(s=1;s<datanumber+1;s++){
      if(data[s].indexOf("<table")>-1)sx=sx+1;
      if(data[s].indexOf("<table")>-1)a[sx]=s;
 
 
    }
 
 
 
        number=sx;
           for(s=1;s<number+1;s++){
   int sp=0;
  for(sx=a[s];sx<datanumber+1;sx++){
   int h=0;
   if(data[sx].indexOf("</tab")>-1)h=h+1;
   if(sp==0)h=h+1;
   if(h==2)sp=sx;
   } 
  b[s]=sp;
  }
 
           for(s=1;s<number+1;s++){
   str="";
               for(sx=a[s];sx<b[s]+1;sx++){
   str=str+data[sx];
    } 
   tab[s]=str;              
 
           }
 
        sx=0;
             for(s=1;s<number+1;s++){
          int h=0;
          if(tab[s].indexOf("次番組")>-1)h=h+1;
          if(tab[s].indexOf("前番組")>-1)h=h+1;
           if(h==2)sx=sx+1;
           if(h==2)tabx[sx]=tab[s];
             }
 
             number=sx;
 
 
 subnumber=0;           
 
 
 
 int de; 
int s5=0;
 for(de=1;de<number+1;de++){   
table sub=new table();
sub.makedata(tabx[de]);
link_p=sub.link;      
name_p=sub.name;     
smap=sub.sta;
subnumber=sub.number;            
 
for(s=1;s<subnumber+1;s++){
s5=s5+1;
link_prev[s5]=link_p[s];
name_prev[s5]=name_p[s];
time[s5]=smap[s];  
}
 
 
}              
 
subnumber=s5; 
 
 
sx=0; 
if(subnumber>0){
 
for(s=1;s<subnumber+1;s++){
 
int h=0;
if(time[s].indexOf(week)>-1)h=h+1;
if(time[s].indexOf(sta)>-1)h=h+1;
int p1=time[s].indexOf(week);
String k="";
if(p1>-1)k=time[s].substring(p1+2,time[s].length());
k=k.replace("時","△");
k=k.replace(":","△");
int p2=k.indexOf("△");
if(p2>0)k=k.substring(0,p2);
int m1=numx(k);
if(m1==time_s)h=h+1;
if(m1==time_s-12)h=h+1;
if(h==3)sx=sx+1;
if(h==3)link[sx]=link_prev[s];
if(h==3)name[sx]=name_prev[s];
if(h==3)term[sx]=time[s]; 
}    
 
 
 
 
 
} 
 
subnumber=sx;
 
 
 
 
 
 
 
 
 }
 
 int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
} 
 
 
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="";
        if(p2>-1)strx=str.substring(p1,p2+1);
        str=str.replace(strx,"");
 
        return str;
    }    
}
 
 
package tvlink;
 
public class table {
 
    int s;
    String[] sta=new String[60];
      String[] name=new String[60];
       String[] link=new String[60];
       String[] link_next=new String[60];
       String[] link_prev=new String[60];
       String[] next=new String[60];
       String[] prev=new String[60];
 
 
        String[] subname=new String[60];
       String[] sublink_next=new String[60];
       String[] sublink_prev=new String[60];
       String[] name_next=new String[60];
       String[] name_prev=new String[60];
    int number;
      String[] time=new String[60];
 
 
void makedata(String t){
 
 String str1="<th colspan=\"3\">";
 
     String[] x=t.split("</tr>");
 
        for(s=0;s<x.length-1;s++){
     time[s]="";
     if(x[s].indexOf(str1)>-1)time[s]=change(x[s]); 
     if(time[s].length()>1)x[s]="";
     int s1=s-1;
     if(s1<0)s1=0;
     if(time[s].length()<1)time[s]=time[s1];
 
        }
 
           for(s=0;s<x.length-1;s++){
     int h=0;
     if(x[s].indexOf("前")>-1)h=h+1;
      if(x[s].indexOf("次")>-1)h=h+1;
     if(h==2)x[s]="";
        }
 
      int sx;
     for(s=0;s<x.length-1;s++){
     String[] y=x[s].split("</td>");
     name_prev[s]="";
     name_next[s]="";
     for(sx=0;sx<y.length;sx++){ 
     if(sx==0)name_prev[s]=change(y[sx]);
     if(sx==2)name_next[s]=change(y[sx]);
 
     }
 
     }   
 
        for(s=0;s<x.length-1;s++){
     String[] y=x[s].split("</td>");
     link_prev[s]="";
     link_next[s]="";
     for(sx=0;sx<y.length;sx++){ 
     if(sx==0)link_prev[s]=alpha(y[sx]);
     if(sx==2)link_next[s]=alpha(y[sx]);
     }
 
     }   
 
           sx=0;
        for(s=0;s<x.length-1;s++){
     if(link_prev[s].indexOf("https://ja.wikipedia.org/")>-1)sx=sx+1;
     if(link_prev[s].indexOf("https://ja.wikipedia.org/")>-1)sta[sx]=time[s];
     if(link_prev[s].indexOf("https://ja.wikipedia.org/")>-1)link[sx]=link_prev[s];
     if(link_prev[s].indexOf("https://ja.wikipedia.org/")>-1)name[sx]=name_prev[s];
     }   
 
        number=sx;
 
 
 
 
 
 
 
}
 String beta(String de){
 int p1=de.indexOf("/wiki/");
 if(p1>-1)p1=de.indexOf(">",p1);
 int p2=-1;  
 if(p1>-1)p2=de.indexOf("</div>",p1);    
 String pp="";
 if(p2>-1)pp=de.substring(p1+1,p2);
        return pp;
    }
String alpha(String de){
 int p1=de.indexOf("/wiki/");
 
 int p2=-1;  
 if(p1>-1)p2=de.indexOf("\"",p1);  
 String pp="";
 if(p2>-1)pp="https://ja.wikipedia.org"+de.substring(p1,p2);
        return pp;
    }
 
String change(String str){
 
        int n;
        for(n=1;n<11;n++){
        str=rev(str);    
        }
 
 
 
        return str;
    }
 
 String rev(String str){
 
        if(str==null)str="";
 
        int p1=str.indexOf("<");
        int p2=str.indexOf(">",p1);
        String strx="";
        if(p2>-1)strx=str.substring(p1,p2+1);
        str=str.replace(strx,"");
 
        return str;
    }    
 
 
 
 
 
}
 
最終更新:2016年09月04日 05:30