Commit Graph
2281 Commits
Author SHA1 Message Date
Alex Osborne aa265855ef ExtractorChrome: Capture requests made by the browser
This adds a `captureRequests` flag to ExtractorChrome which is enabled
by default and causes requests made by the browser to be captured via
the devtools Network domain. Captured browser requests are sent to the
disposition chain for WARC writing and also to statistics tracker and
crawl log.

Browser requests are given the annotation "browser" so they can be
easily distinguished in the log from normal requests.

There are a quite a few limitations that will be addressed in followup
work:

* The frontier is entirely unaware of browser requests. This means they
  bypass quotas, ignore scope rules, politeness and don't count towards
  the statistics tracked by the frontier itself.

* There's no replay of previously saved resources so duplicate requests
  for the same URL end up being made.

* Heritrix's extractors do not currently process browser requests.

* Various error and failure cases likely need improving.
2021-07-06 00:59:26 +09:00
Alex Osborne 512acfc616 Merge pull request #403 from internetarchive/extractor-chrome
Add ExtractorChrome to contrib
2021-06-30 14:07:04 +09:00
Alex Osborne 17375bac26 Merge pull request #409 from internetarchive/server-ip-attribute
Fix WARC-IP-Address and use a common server-ip CrawlURI attribute for all protocols
2021-06-30 12:34:21 +09:00
Alex Osborne 671eca0e76 Merge pull request #408 from internetarchive/crawl-log-syntax
Add basic syntax highlighting to the crawl.log viewer
2021-06-30 12:33:23 +09:00
Alex Osborne 200f1cf38f DNS: Use the new protocol-agnostic server IP attribute
Also fixes an issue where in some cases we would incorrectly output
WARC-IP-Address for DNS records as "/127.0.0.53:53" instead of
"127.0.0.53".
2021-06-25 16:39:59 +09:00
Alex Osborne c378c46e49 WHOIS: Replace A_WHOIS_SERVER_IP with the generic A_SERVER_IP one 2021-06-25 14:39:26 +09:00
Alex Osborne 6b42c608a5 BaseWARCRecordBuilder: remove now unused getHostAddress(curi) helper
We now save the server IP at fetch time and retrieve it with
CrawlURI.getServerIP()
2021-06-25 14:39:26 +09:00
Alex Osborne ef3b428061 FTP: Save server IP at fetch time and use in WARC-IP-Address 2021-06-25 14:39:26 +09:00
Alex Osborne 13c0f65294 FTP: Implement a basic fetch test 2021-06-25 14:09:38 +09:00
Alex Osborne 28ea9c4ba5 HTTP: Populate WARC-IP-Address with server's IP address
Fixes #396
2021-06-25 13:34:40 +09:00
Alex Osborne 5a6531b296 CrawlURI: Introduce a protocol-agnostic server-ip attribute
The vast majority of protocols we use will have a server IP address,
so rather than having a separate one for each protocol let's just use
a single common one.
2021-06-25 13:24:20 +09:00
Alex Osborne c26307068f Merge pull request #406 from internetarchive/run-job-option
Fix and document the -r option which runs a named job on startup
2021-06-25 11:53:14 +09:00
Alex Osborne 6835d0940e Merge pull request #407 from internetarchive/fix-maven-warnings
Fix a couple of boring maven warnings
2021-06-25 11:52:53 +09:00
Alex Osborne 6f32d018be Merge pull request #405 from internetarchive/faster-tests
Speed up test suite
2021-06-25 11:52:40 +09:00
Alex Osborne 04f958e987 Merge pull request #404 from internetarchive/github-ci
Switch from Travis CI to Github Actions
2021-06-25 11:52:01 +09:00
Alex Osborne e9d5966c22 Add basic syntax highlighting to the crawl.log viewer
Colour-codes the fetch status codes and shows the corresponding
status message when you hover over them. No more referring to the
glossary. :-)
2021-06-22 23:06:53 +09:00
Alex Osborne 039634cee0 Update relocated dependencies
Fixes the Maven warnings:

    [WARNING] The artifact poi:poi:jar:2.5.1 has been relocated to
        poi:poi:jar:2.5.1-final-20040804
    [WARNING] The artifact itext:itext:jar:1.3 has been relocated to
        com.lowagie:itext:jar:1.3
2021-06-22 20:52:55 +09:00
Alex Osborne e47469b69c Remove obsolete prerequisites element from parent pom
Maven 2.0.9 was 13 years ago. I think we can safely assume everyone has
a newer maven now. ;-)

This stops Maven printing this warning:

    [WARNING] The project org.archive:heritrix:pom:3.4.0-SNAPSHOT uses
    prerequisites which is only intended for maven-plugin projects but
    not for non maven-plugin projects. For such purposes you should use
    the maven-enforcer-plugin.
2021-06-22 20:49:36 +09:00
Alex Osborne a38fda2b72 Fix and document the -r option which runs a named job on startup
I noticed there was a non-functional and undocumented -r command-line
option which automatically runs a given job when Heritrix starts. I
suspect this was never finished due to the bug that was fixed in commit
643f16d where launch() returns before the job has been launched.

This option seems like it would be very useful so you could run a job
from cron or another scheduling program without having to use the
REST API to start it. Therefore I've enabled it and extended it so it
also unpauses, waits for the crawl to finish and then exits.
2021-06-22 20:16:23 +09:00
Alex Osborne 643f16d20c Remove arbitrary 1.5 second sleep() when launching jobs
I think the sleep is supposed to make launch() not return until the job
has actually been launched but it doesn't work as launch()
and getCrawlController() are both synchronized therefore the
launcher thread can't actually call startContext() until launch()
returns after sleeping.

So let's replace the sleep call with join and unsynchronize launch()
so it doesn't deadlock. All the relevant methods it calls seem to be
synchronized so I think it's no worse to not synchronize it itself.
2021-06-22 19:43:38 +09:00
Alex Osborne c0cb68f754 Speed up the unit tests by changing some 1s polling sleeps to 250ms
Lots of 1 second sleeps add up fast. On my PC this reduces the runtime
of `mvn clean test` from about 3m 40s to about 1m 50s.

Ideally we'd probably re-architect some this to use a notification
mechanism instead of polling but that's easier said than done and this
is a pretty big improvement by itself.
2021-06-22 17:10:50 +09:00
Alex Osborne 16a49d3527 Remove arbitrary 1.5 second sleep() when launching jobs
I think the sleep is supposed to make launch() not return until the job
has actually been launched but it doesn't work as launch()
and getCrawlController() are both synchronized therefore the
launcher thread can't actually call startContext() until launch()
returns after sleeping.

So let's replace the sleep call with join and unsynchronize launch()
so it doesn't deadlock. All the relevant methods it calls seem to be
synchronized so I think it's no worse to not synchronize it itself.
2021-06-22 17:10:50 +09:00
Alex Osborne d643770a7c Put slowest unit tests behind a -DrunSlowTests=true option
Shaves about 2 minutes off the Heritrix build time.
2021-06-22 17:10:50 +09:00
Alex Osborne 175f2938d1 Workaround Maven connection timeout in Github Action 2021-06-22 13:13:18 +09:00
Alex Osborne a5c610f488 Switch from Travis CI to Github Actions
The CI builds are no longer working as travis-ci.org has been
discontinued so switch to using Github Actions instead.

We need to use a custom settings.xml for now as Maven now blocks
non-https repositories by default and builds.archive.org isn't
available via https.
2021-06-22 12:16:08 +09:00
Andrew Jackson c9369da6b8 Updated changelog. 2021-06-21 22:09:51 +01:00
Andrew Jackson 0e93e22ba9 [maven-release-plugin] prepare for next development iteration 2021-06-21 15:42:52 +01:00
Andrew Jackson 846f2bc2cc [maven-release-plugin] prepare release 3.4.0-20210621 3.4.0-20210621 2021-06-21 15:42:46 +01:00
Andrew Jackson 33a01a3bb6 Merge branch 'master' of github.com:internetarchive/heritrix3 2021-06-21 14:28:38 +01:00
Andrew Jackson 6d0ae8f916 Remove unnecessary Maven setup that breaks cross-JDK builds. 2021-06-21 14:18:52 +01:00
Andrew Jackson c75e710183 Update Changlog. 2021-06-21 14:18:06 +01:00
Alex Osborne 7ff4420801 Add ExtractorChrome to contrib
This adds a link extractor that uses a headless browser via the Chrome
Devtools Protocol. It works with Chromium and Google Chrome and
while untested likely also other Blink-based browsers such as Brave and
Microsoft Edge. It also works with Firefox which implements a subset of
the protocol.

In addition to ExtractorChrome itself this adds a couple of classes
under org.archive.net.chrome for communicating with the browser:

* ChromeProcess - manages the lifecycle of the browser child process
* ChromeClient  - client for the Chrome Devtools Protocol
* ChromeWindow  - client for controlling a particular browser window

Why this extractor when we already have Umbra? The primary goal is to
have something that works out of the box without any additional
infrastructure beyond having a browser installed. A longer term goal is
to be able to take advantage of tighter integration between Heritrix
and the browser to do things like recording browser subrequests to WARC
files or running ExtractorHTML against the loaded DOM.

While this extractor is already usable it is currently quite bare bones
and only extracts links from <a> and <area> tags. The intent is to
expand it with more functionality over time with features like
intercepting subrequests, reusing previously saved resources, taking
screenshots or running JavaScript behaviours.
2021-06-21 13:30:17 +09:00
Andy Jackson 31e54ccdb0 Merge pull request #402 from internetarchive/remove-mg4j
Remove dependency on mg4j
2021-06-20 23:08:24 +01:00
Alex Osborne b917a32eab Merge pull request #401 from kris-sigur/shutdown
Graceful UI shutdown
2021-06-20 23:47:44 +09:00
Alex Osborne 5d0a5b2ec4 Remove dependency on mg4j
This eliminates one of the jars that Heritrix depends on that isn't in
Maven Central.

There were only two usages. The first usage was a method in a
CrawlerJournal which as far as I can tell is unused and can be removed.

The second usage was an unnecessary use of MutableString as a line
buffer when saving cookies to a file. Since there doesn't seem any
particular reason buffer per-line here let's just use a BufferedWriter
instead on the whole file which is also slightly simpler and more
efficient.
2021-06-20 23:30:41 +09:00
Kristinn Sigurdsson 37913cbb2e Graceful UI shutdown 2021-06-18 10:56:20 +00:00
Andrew Jackson a34e40a9f8 Update changelog. 2021-06-18 10:25:54 +01:00
Andy Jackson 50de3eea08 Merge pull request #400 from kris-sigur/robots-sitemap
Remove unnecessary fiddling with VIA path in ExtractorRobotsTxt
2021-06-18 10:14:11 +01:00
Andrew Jackson 07ada5f838 Update changelog. 2021-06-18 09:57:51 +01:00
Kristinn Sigurdsson 627befe07e Remove unnecessary fiddling with VIA path 2021-06-18 08:42:05 +00:00
Andrew Jackson a5beb7d6e9 [maven-release-plugin] prepare for next development iteration 2021-06-18 09:41:30 +01:00
Andrew Jackson 30598f8402 [maven-release-plugin] prepare release 3.4.0-20210618 3.4.0-20210618 2021-06-18 09:41:24 +01:00
Andrew Jackson 22b07e151a Merge branch 'master' of github.com:internetarchive/heritrix3 2021-06-18 09:37:37 +01:00
Andrew Jackson 768c6ef458 Update changelog. 2021-06-18 09:37:13 +01:00
Andy Jackson b60ae999cc Merge pull request #399 from ukwa/master
Switch to properties that enforce Java 8 compatibility.
2021-06-17 21:23:39 +01:00
Andrew Jackson 2007ddb005 Switch to properties that enforce Java 8 compatibility. 2021-06-17 21:22:04 +01:00
Andrew Jackson 18e8779398 Updated changelog. 2021-06-17 16:42:23 +01:00
Andrew Jackson 3423cab6a6 [maven-release-plugin] prepare for next development iteration 2021-06-17 14:39:00 +01:00
Andrew Jackson 7368ded9c2 [maven-release-plugin] prepare release 3.4.0-20210617 3.4.0-20210617 2021-06-17 14:38:54 +01:00
Andrew Jackson a5164dbcea Update changelog. 2021-06-17 14:34:22 +01:00