アットウィキロゴ

ぽ00

package den;
 
import tool.*;
import java.io.*;
 
 
public class pro {
 
 
 
    int s,datanumber;
    String[] data=new String[6000];
  String urlx;
 int[] point=new int[600];
    String[] subdata=new String[6000];
   String[] author=new String[6000];
      String[] title=new String[6000];
       String[] id=new String[6000];
 
    public static void main(String[] args) {
       pro tes=new pro();
    }
 
    pro(){
 
 
        makeutf sub2=new makeutf();
        String a1=sub2.makedata("ぼくは麻理のなか(4)");
 
   urlx="https://www.googleapis.com/books/v1/volumes?q=";
   urlx=urlx+a1;   
   urlx=urlx+"&ke=AIzaSyAH0WCAXRIdHdbI-6bnMSN4kVDDZZmGyqY";
 
 
       getdata sub=new getdata();
        sub.makedata(urlx,"UTF-8");
        data=sub.data;
        datanumber=sub.datanumber;
 
        int sx=0;
        for(s=1;s<datanumber+1;s++){
        if(data[s].indexOf("kind")>-1)sx=sx+1;
        if(data[s].indexOf("kind")>-1)point[sx]=s;      
        }
  sx=sx+1;
  point[sx]=datanumber;
  int number=sx;
 
  for(s=1;s<number;s++){
      String str="";
  for(sx=point[s];sx<point[s+1];sx++){
 str=str+data[sx]; 
  }
  subdata[s]=str;
 
 
  }
 
 
 
 for(s=2;s<number;s++){
author[s]=author(subdata[s]);
title[s]=title(subdata[s]);
id[s]=id(subdata[s]);
  System.out.println(id[s]);
  }
 
 
 
 
 
 
 
 
 
    }
  String title(String str){
 
      int p1=str.indexOf("title");
      p1=str.indexOf(":",p1);
      p1=str.indexOf("\"",p1);
      int p2=str.indexOf("\"",p1+1);
 
      String strx=str.substring(p1+1,p2);
      return strx;
  }
  String id(String str){
 
      int p1=str.indexOf("id");
      p1=str.indexOf(":",p1);
      p1=str.indexOf("\"",p1);
      int p2=str.indexOf("\"",p1+1);
 
      String strx=str.substring(p1+1,p2);
      return strx;
  }
 
 
     String author(String str){
 
      int p1=str.indexOf("author");
      p1=str.indexOf(":",p1);
      p1=str.indexOf("\"",p1);
      int p2=str.indexOf("\"",p1+1);
 
      String strx=str.substring(p1+1,p2);
      return strx;
  }
 
 
 
 
}
 
最終更新:2015年10月14日 08:56