1 package org.paneris.bibliomania.metasearch.bol; 2 3 import java.io.FileInputStream; 4 5 import org.melati.util.IoUtils; 6 import org.paneris.bibliomania.metasearch.BookPageBase; 7 8 public class BookPage extends BookPageBase { 9 10 protected static final byte[] 11 bookcover = "/bookcover/".getBytes(), 12 isbncue = "ISBN".getBytes(), 13 price = "price".getBytes(); 14 15 public BookPage(byte[] text) { 16 super(text); 17 try { 18 skipTo(bookcover); 19 imageURL = quotedStringFromBack(bookcover.length); 20 } 21 catch (Exception e) { 22 here = 0; 23 skipTo(price); 24 } 25 26 try { 27 skipTo(isbncue); 28 skipSpace(); 29 isbn = digits(); 30 } 31 catch (ParseException e) { 32 } 33 catch (ArrayIndexOutOfBoundsException e) { 34 } 35 36 this.text = null; 37 } 38 39 public static void main(String[] args) throws Exception { 40 BookPage p = 41 new BookPage(IoUtils.slurp(new FileInputStream(args[0]), 1000)); 42 System.out.println(p.imageURL); 43 System.out.println(p.isbn); 44 } 45 }