Download Heritrix User Manual
Transcript
Heritrix User Manual ule. Removing this rule will keep Heritrix from straying off of our www.foo.org host. A few of the rules like PathologicalPathDecideRule and TooManyPathSegmentsDecideRule will allow Heritrix to avoid some types of crawler traps. The TooManyHopsDecideRule will keep Heritrix from following too many links away from the seed so the calendar doesn't trap Heritrix in an infinite loop. By default, the hop path is set to 15, but you can change that on the Settings screen. Alternatively, you may add the MatchesFilePatternDecideRule. Set use-preset-pattern to CUSTOM and set regexp to something like: .*foo\.org(?!/calendar).*|.*foo\.org/calendar\?year=200[56].* Finally, you'll need to set the user-agent and from fields on the Settings screen, and then you may submit the job and monitor the crawl. A.2. Only Store Successful HTML Pages Suppose you wanted to only grab the first 50 pages encountered from a set of seeds and archive only those pages that return a 200 response code and have the text/html MIME type. Additionally, you only want to look for links in HTML resources. When you create your job, use the DecidingScope with the default set of DecideRules. In order to examine HTML documents only for links, you will need to remove the following extractors that tell Heritrix to look for links in style sheets, JavaScript, and Flash files: 1. ExtractorCSS 2. ExtractorJS 3. ExtractorSWF You should leave in the ExtractorHTTP since it is useful in locating resources that can only be found using a redirect (301 or 302). You can limit the number of files to download by setting max-document-download on the Settings screen. Setting this value to 50 will probably not have the results you intend. Since each DNS response and robots.txt file is counted in this number, you'll likely want to use the value of 50 * number of seeds * 2. Next, you will need to add filters to the ARCWriterProcessor so that it only records documents with a 200 status code and a mime-type of text/html. The first filter to add is the ContentTypeRegExpFilter; set its regexp setting to text/html.*. Next, add a DecidingFilter to the ARCWriterProcessor, then add FetchStatusDecideRule to the DecidingFilter. You'll probably want to apply the above filters to the mid-fetch-filters setting of FetchHTTP as well. That will prevent FetchHTTP from downloading the content of any non-html or non-successful documents. Once you have entered the desired settings, start the job and monitor the crawl. A.3. Mirroring .html Files Only Suppose you only want to crawl URLs that match http://foo.org/bar/*.html, and you'd like to save the crawled files in a file/directory format instead of saving them in ARC files. Suppose you also know that you are crawling a web server that is case sensitive (http://foo.org/bar/abc.html and http://foo.org/bar/ABC.HTML are pointing to two different resources). 51