1 package org.paneris.bibliomania.metasearch.bob;
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 jackets = "jackets".getBytes(),
12 isbncue = "ISBN:".getBytes(),
13 size2 = "size=2>".getBytes();
14
15 public BookPage(byte[] text) {
16 super(text);
17 try {
18 skipTo(jackets);
19 imageURL = quotedStringFromBack(jackets.length);
20 }
21 catch (Exception e) {
22 here = 0;
23 }
24
25 try {
26 skipTo(isbncue);
27 skipTo(size2);
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 }