Skip to main content

Distributed web crawling with browsers

Reason this release was yanked:

prefer pypi package brozzler

Project description

https://api.travis-ci.org/internetarchive/brozzler.svg?branch=master

logo brozzler

“browser” | “crawler” = “brozzler”

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 employs yt-dlp (formerly youtube-dl) to enhance media capture capabilities and rethinkdb to manage crawl state.

Brozzler is designed to work in conjunction with warcprox for web archiving.

Requirements

  • Python 3.5 or later

  • RethinkDB deployment

  • Chromium or Google Chrome >= version 64

Note: The browser requires a graphical environment to run. When brozzler is run on a server, this may require deploying some additional infrastructure, typically X11. Xvnc4 and Xvfb are X11 variants that are suitable for use on a server, because they don’t display anything to a physical screen. The vagrant configuration in the brozzler repository has an example setup using Xvnc4. (When last tested, chromium on Xvfb did not support screenshots, so Xvnc4 is preferred at this time.)

Getting Started

The easiest way to get started with brozzler for web archiving is with brozzler-easy. Brozzler-easy runs brozzler-worker, warcprox, brozzler wayback, and brozzler-dashboard, configured to work with each other in a single process.

Mac instructions:

# install and start rethinkdb
brew install rethinkdb
# no brew? try rethinkdb's installer: https://www.rethinkdb.com/docs/install/osx/
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

# start brozzler-easy
brozzler-easy

At this point brozzler-easy will start archiving your site. Results will be immediately available for playback in pywb at http://localhost:8880/brozzler/.

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

Launch one or more workers: [*]

brozzler-worker --warcprox-auto

Submit jobs:

brozzler-new-job myjob.yaml

Submit sites not tied to a job:

brozzler-new-site --time-limit=600 http://example.com/

Job Configuration

Brozzler jobs are defined using YAML files. Options may be specified either at the top-level or on individual seeds. At least one seed URL must be specified, however everything else is optional. For details, see job-conf.rst.

id: myjob
time_limit: 60 # seconds
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,

Brozzler Dashboard

Brozzler comes with a rudimentary web application for viewing crawl job status. To install the brozzler with dependencies required to run this app, run

pip install brozzler[dashboard]

To start the app, run

brozzler-dashboard

At this point Brozzler Dashboard will be accessible at http://localhost:8000/.

Brozzler-Dashboard.png

See brozzler-dashboard --help for configuration options.

Brozzler Wayback

Brozzler comes with a customized version of 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/.

Brozzler-Wayback.png

Headless Chrome (experimental)

Brozzler is known to work nominally with Chrome/Chromium in headless mode, but this has not yet been extensively tested.

License

Copyright 2015-2024 Internet Archive

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brozzler_ia-1.6.1.tar.gz (95.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brozzler_ia-1.6.1-py3-none-any.whl (94.2 kB view details)

Uploaded Python 3

File details

Details for the file brozzler_ia-1.6.1.tar.gz.

File metadata

  • Download URL: brozzler_ia-1.6.1.tar.gz
  • Upload date:
  • Size: 95.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.19

File hashes

Hashes for brozzler_ia-1.6.1.tar.gz
Algorithm Hash digest
SHA256 2acc2f1e640ffe902a20081e8206bf120de8deadfe8d98b940eb59c7dcffbcb9
MD5 8d4f7646b7b9ab91e48a7e0b0ecc91a8
BLAKE2b-256 580d86ecd634adc6cc53f960d68cf45b686166d0fb248ed08b181c3ab91eac91

See more details on using hashes here.

File details

Details for the file brozzler_ia-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: brozzler_ia-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 94.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.19

File hashes

Hashes for brozzler_ia-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9dbc3d10f452f7a446b2b10814f70a7091edfc3f8b6203d4d6c34137b6ea8f6
MD5 1c3953ec97d7d866fdd89ba7809ca47d
BLAKE2b-256 bffd03546b76cffc8ce79cdd19fc5509b41b307a611285e362bb8062db4b7e45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page