| 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 | 0 | jackets = "jackets".getBytes(), |
| 12 | 0 | isbncue = "ISBN:".getBytes(), |
| 13 | 0 | size2 = "size=2>".getBytes(); |
| 14 | |
|
| 15 | |
public BookPage(byte[] text) { |
| 16 | 0 | super(text); |
| 17 | |
try { |
| 18 | 0 | skipTo(jackets); |
| 19 | 0 | imageURL = quotedStringFromBack(jackets.length); |
| 20 | |
} |
| 21 | 0 | catch (Exception e) { |
| 22 | 0 | here = 0; |
| 23 | 0 | } |
| 24 | |
|
| 25 | |
try { |
| 26 | 0 | skipTo(isbncue); |
| 27 | 0 | skipTo(size2); |
| 28 | 0 | skipSpace(); |
| 29 | 0 | isbn = digits(); |
| 30 | |
} |
| 31 | 0 | catch (ParseException e) { |
| 32 | |
} |
| 33 | 0 | catch (ArrayIndexOutOfBoundsException e) { |
| 34 | 0 | } |
| 35 | |
|
| 36 | 0 | this.text = null; |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
public static void main(String[] args) throws Exception { |
| 40 | 0 | BookPage p = |
| 41 | |
new BookPage(IoUtils.slurp(new FileInputStream(args[0]), 1000)); |
| 42 | 0 | System.out.println(p.imageURL); |
| 43 | 0 | System.out.println(p.isbn); |
| 44 | 0 | } |
| 45 | |
} |