2016-11-16 12:26:50 -08:00
|
|
|
.. image:: https://travis-ci.org/internetarchive/brozzler.svg?branch=master
|
|
|
|
:target: https://travis-ci.org/internetarchive/brozzler
|
2017-01-31 10:26:38 -08:00
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
.. |logo| image:: https://cdn.rawgit.com/internetarchive/brozzler/1.1b5/brozzler/webconsole/static/brozzler.svg
|
2017-03-22 15:23:47 -07:00
|
|
|
:width: 60px
|
2015-10-07 17:53:16 -07:00
|
|
|
|
2017-01-31 10:26:38 -08:00
|
|
|
|logo| brozzler
|
2015-10-07 17:53:16 -07:00
|
|
|
===============
|
2015-09-23 22:35:26 +00:00
|
|
|
"browser" \| "crawler" = "brozzler"
|
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
Brozzler is a distributed web crawler (爬虫) that uses a real browser (chrome
|
|
|
|
or chromium) to fetch pages and embedded urls and to extract links. It also
|
|
|
|
uses `youtube-dl <https://github.com/rg3/youtube-dl>`_ to enhance media
|
|
|
|
capture capabilities.
|
2015-09-23 22:35:26 +00:00
|
|
|
|
|
|
|
Brozzler is designed to work in conjunction with
|
2016-08-05 18:28:30 -07:00
|
|
|
`warcprox <https://github.com/internetarchive/warcprox>`_ for web
|
2015-09-23 22:35:26 +00:00
|
|
|
archiving.
|
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
Requirements
|
2015-09-23 22:35:26 +00:00
|
|
|
------------
|
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
- Python 3.4 or later
|
|
|
|
- RethinkDB deployment
|
|
|
|
- Chromium or Google Chrome browser
|
|
|
|
|
|
|
|
Worth noting is that the browser requires a graphical environment to run. You
|
|
|
|
already have this on your laptop, but on a server it will probably require
|
|
|
|
deploying some additional infrastructure (typically X11). The vagrant
|
|
|
|
configuration in the brozzler repository (still a work in progress) has an
|
|
|
|
example setup.
|
|
|
|
|
|
|
|
Getting Started
|
|
|
|
---------------
|
|
|
|
|
|
|
|
The easiest way to get started with brozzler for web archiving is with
|
2016-08-08 17:43:38 -07:00
|
|
|
``brozzler-easy``. Brozzler-easy runs brozzler-worker, warcprox,
|
2016-11-04 17:46:23 -07:00
|
|
|
`pywb <https://github.com/ikreymer/pywb>`_, and brozzler-dashboard, configured
|
2016-08-08 17:43:38 -07:00
|
|
|
to work with each other, in a single process.
|
2016-08-05 18:28:30 -07:00
|
|
|
|
|
|
|
Mac instructions:
|
2016-06-25 15:44:27 -05:00
|
|
|
|
2015-09-23 22:35:26 +00:00
|
|
|
::
|
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
# install and start rethinkdb
|
|
|
|
brew install rethinkdb
|
2016-10-16 11:01:12 -07:00
|
|
|
# no brew? try rethinkdb's installer: https://www.rethinkdb.com/docs/install/osx/
|
2016-08-05 18:28:30 -07:00
|
|
|
rethinkdb &>>rethinkdb.log &
|
|
|
|
|
|
|
|
# install brozzler with special dependencies pywb and warcprox
|
|
|
|
pip install brozzler[easy] # in a virtualenv if desired
|
|
|
|
|
|
|
|
# queue a site to crawl
|
|
|
|
brozzler-new-site http://example.com/
|
|
|
|
|
|
|
|
# or a job
|
|
|
|
brozzler-new-job job1.yml
|
2015-09-23 22:35:26 +00:00
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
# start brozzler-easy
|
|
|
|
brozzler-easy
|
2015-09-23 22:35:26 +00:00
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
At this point brozzler-easy will start brozzling your site. Results will be
|
2016-08-12 17:02:41 -07:00
|
|
|
immediately available for playback in pywb at http://localhost:8880/brozzler/.
|
2016-08-05 18:28:30 -07:00
|
|
|
|
|
|
|
*Brozzler-easy demonstrates the full brozzler archival crawling workflow, but
|
|
|
|
does not take advantage of brozzler's distributed nature.*
|
|
|
|
|
|
|
|
Installation and Usage
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
To install brozzler only:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
pip install brozzler # in a virtualenv if desired
|
2016-05-17 15:20:09 +10:00
|
|
|
|
|
|
|
Launch one or more workers:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2017-03-24 13:55:23 -07:00
|
|
|
brozzler-worker --warcprox-auto
|
2016-05-17 15:20:09 +10:00
|
|
|
|
|
|
|
Submit jobs:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
brozzler-new-job myjob.yaml
|
|
|
|
|
2016-08-05 18:28:30 -07:00
|
|
|
Submit sites not tied to a job:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2017-03-24 13:55:23 -07:00
|
|
|
brozzler-new-site --time-limit=600 http://example.com/
|
2016-08-05 18:28:30 -07:00
|
|
|
|
2016-05-17 15:20:09 +10:00
|
|
|
Job Configuration
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
Jobs are defined using yaml files. Options may be specified either at the
|
2017-02-03 14:53:50 -08:00
|
|
|
top-level or on individual seeds. At least one seed url must be specified,
|
|
|
|
everything else is optional. For details, see `<job-conf.rst>`_.
|
2016-05-17 15:20:09 +10:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
id: myjob
|
|
|
|
time_limit: 60 # seconds
|
2016-05-17 16:20:38 +10:00
|
|
|
proxy: 127.0.0.1:8000 # point at warcprox for archiving
|
2016-05-17 15:20:09 +10:00
|
|
|
ignore_robots: false
|
|
|
|
warcprox_meta: null
|
|
|
|
metadata: {}
|
|
|
|
seeds:
|
|
|
|
- url: http://one.example.org/
|
|
|
|
- url: http://two.example.org/
|
|
|
|
time_limit: 30
|
|
|
|
- url: http://three.example.org/
|
|
|
|
time_limit: 10
|
|
|
|
ignore_robots: true
|
|
|
|
scope:
|
|
|
|
surt: http://(org,example,
|
|
|
|
|
2016-11-04 17:46:23 -07:00
|
|
|
Brozzler Dashboard
|
|
|
|
------------------
|
2016-06-27 12:43:24 -05:00
|
|
|
|
|
|
|
Brozzler comes with a rudimentary web application for viewing crawl job status.
|
|
|
|
To install the brozzler with dependencies required to run this app, run
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2016-11-04 17:46:23 -07:00
|
|
|
pip install brozzler[dashboard]
|
2016-06-27 12:43:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
To start the app, run
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2016-11-04 17:46:23 -07:00
|
|
|
brozzler-dashboard
|
2016-06-27 12:43:24 -05:00
|
|
|
|
2016-11-04 17:46:23 -07:00
|
|
|
See ``brozzler-dashboard --help`` for configuration options.
|
2015-09-23 22:35:26 +00:00
|
|
|
|
2017-01-31 10:26:38 -08:00
|
|
|
Brozzler Wayback
|
|
|
|
----------------
|
|
|
|
|
|
|
|
Brozzler comes with a customized version of
|
|
|
|
`pywb <https://github.com/ikreymer/pywb>`_ which supports using the rethinkdb
|
|
|
|
"captures" table (populated by warcprox) as its index.
|
|
|
|
|
|
|
|
To use, first install dependencies.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
pip install brozzler[easy]
|
|
|
|
|
|
|
|
Write a configuration file pywb.yml.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# 'archive_paths' should point to the output directory of warcprox
|
|
|
|
archive_paths: warcs/ # pywb will fail without a trailing slash
|
|
|
|
collections:
|
|
|
|
brozzler:
|
|
|
|
index_paths: !!python/object:brozzler.pywb.RethinkCDXSource
|
|
|
|
db: brozzler
|
|
|
|
table: captures
|
|
|
|
servers:
|
|
|
|
- localhost
|
|
|
|
enable_auto_colls: false
|
|
|
|
enable_cdx_api: true
|
|
|
|
framed_replay: true
|
|
|
|
port: 8880
|
|
|
|
|
|
|
|
Run pywb like so:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ PYWB_CONFIG_FILE=pywb.yml brozzler-wayback
|
|
|
|
|
|
|
|
Then browse http://localhost:8880/brozzler/.
|
|
|
|
|
|
|
|
|
2017-04-25 14:58:43 +10:00
|
|
|
Headless Chrome (experimental)
|
|
|
|
--------------------------------
|
2016-09-29 07:55:39 +10:00
|
|
|
|
|
|
|
`Headless Chromium <https://chromium.googlesource.com/chromium/src/+/master/headless/README.md>`_
|
2017-04-25 14:58:43 +10:00
|
|
|
is now available in stable Chrome releases for 64-bit Linux and may be
|
|
|
|
used to run the browser without a visibe window or X11 at all.
|
2016-09-29 07:55:39 +10:00
|
|
|
|
2017-04-25 14:58:43 +10:00
|
|
|
To try this out, create a wrapper script like ~/bin/chrome-headless.sh:
|
2016-09-29 07:55:39 +10:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
#!/bin/bash
|
2017-04-25 14:58:43 +10:00
|
|
|
exec /opt/google/chrome/chrome --headless --disable-gpu "$@"
|
2016-09-29 07:55:39 +10:00
|
|
|
|
|
|
|
Run brozzler passing the path to the wrapper script as the ``--chrome-exe``
|
|
|
|
option:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2017-04-25 14:58:43 +10:00
|
|
|
chmod +x ~/bin/chrome-headless.sh
|
|
|
|
brozzler-worker --chrome-exe ~/bin/chrome-headless.sh
|
2016-10-02 23:40:41 +11:00
|
|
|
|
2017-04-25 14:58:43 +10:00
|
|
|
Beware: Chrome's headless mode is still very new and has a number of
|
|
|
|
`unresolved issues. <https://bugs.chromium.org/p/chromium/issues/list?can=2&q=Proj%3DHeadless>`_
|
|
|
|
You may experience hangs or crashes with some types of content. Brozzler
|
|
|
|
has not had much testing with it. For the moment we recommend using
|
|
|
|
Chrome's regular mode instead.
|
2016-10-02 23:40:41 +11:00
|
|
|
|
2015-09-23 22:35:26 +00:00
|
|
|
License
|
|
|
|
-------
|
|
|
|
|
2017-01-31 10:26:38 -08:00
|
|
|
Copyright 2015-2017 Internet Archive
|
2015-09-23 22:35:26 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
not use this software except in compliance with the License. You may
|
|
|
|
obtain a copy of the License at
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
|