1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.smartcrawler.examples;
28
29 import org.smartcrawler.common.MalformedLinkException;
30 import org.smartcrawler.*;
31
32 /***
33 * The engine thread which is started by the {@link org.smartcrawler.Crawler}
34 *
35 * @author <a href="mailto:pozzad@alice.it">Davide Pozza</a>
36 * @version <tt>$Revision: 1.9 $</tt>
37 */
38 public class QuickTest {
39
40 /***
41 * Creates a new instance of QuickTest
42 */
43 public QuickTest() {
44
45 }
46 /***
47 * The main method
48 *
49 * @param args the command line arguments
50 */
51 public static void main(String[] args) {
52 String urlStr = null;
53 String configFileName = null;
54
55
56
57
58
59 urlStr = "http://images.google.it/images?q=casa&hl=it";
60 configFileName = "examples/googleImages/conf/google_images-config.xml";
61 System.setProperty("extractionPatterns.file.path", "examples/googleImages/conf/extractPatterns.xml");
62
63
64
65
66
67
68
69
70 urlStr = "http://www.photosig.com/go/photos/view;jsessionid=5CACE7874611EFEBE567706E1565D291?id=1577721&forward=browse";
71 configFileName = "examples/photosig/conf/photosig-config.xml";
72 System.setProperty("extractionPatterns.file.path", "examples/photosig/conf/extractPatterns.xml");
73 try {
74
75 new Crawler(urlStr, configFileName).startEngines();
76
77 } catch (MalformedLinkException e){
78 System.out.println("Invalid initial link! " + urlStr);
79 } catch (Exception e){
80 System.out.println("Generic error");
81 e.printStackTrace();
82 }
83 }
84 }