Convert Figma logo to code with AI

webrecorder logopywb

Core Python Web Archiving Toolkit for replay and recording of web archives

1,425
219
1,425
167

Top Related Projects

Heritrix is the Internet Archive's open-source, extensible, web-scale, archival-quality web crawler project.

Quick Overview

The pywb project is a Python-based web archiving framework that provides tools for capturing, replaying, and analyzing web content. It is designed to be a flexible and extensible platform for building web archiving applications.

Pros

  • Flexible and Extensible: pywb is designed to be a modular and extensible framework, allowing developers to easily integrate it into their own applications or extend its functionality.
  • Robust Replay Capabilities: The project provides a powerful web replay engine that can accurately reproduce the original web experience, including support for JavaScript, CSS, and other dynamic content.
  • Comprehensive Archiving Tools: pywb includes a range of tools for capturing, indexing, and managing web archives, making it a comprehensive solution for web archiving needs.
  • Active Development and Community: The project has an active development team and a growing community of contributors, ensuring ongoing support and improvements.

Cons

  • Steep Learning Curve: The flexibility and extensibility of pywb can also make it challenging for new users to get started, as there is a significant learning curve involved.
  • Limited Documentation: While the project has good documentation, some areas may be lacking in detail or clarity, which can make it difficult for new users to get up and running.
  • Performance Concerns: Depending on the scale and complexity of the web archives being managed, pywb may experience performance issues, particularly when replaying large or complex web pages.
  • Limited Deployment Options: The project is primarily designed for deployment on Linux-based systems, which may limit its usefulness for users on other platforms.

Code Examples

Here are a few examples of how to use the pywb library:

  1. Capturing a Web Page:
from pywb.recorder.recorder import WBRecorder

recorder = WBRecorder()
recorder.record('http://example.com', 'example.warc.gz')

This code uses the WBRecorder class to capture a web page and store it in a WARC file.

  1. Replaying a Web Archive:
from pywb.webapp.pywb_init import create_wb_handler
from pywb.framework.wsgi_wrappers import WSGIApp

app = create_wb_handler('example.warc.gz')
WSGIApp(app).run()

This code creates a WSGI application that can be used to replay the web content stored in the example.warc.gz file.

  1. Indexing a Web Archive:
from pywb.indexer.indexer import WBIndexer

indexer = WBIndexer()
indexer.index('example.warc.gz', 'example_index')

This code uses the WBIndexer class to create an index for the web content stored in the example.warc.gz file, which can be used to improve the performance of web page replays.

Getting Started

To get started with pywb, you can follow these steps:

  1. Install the pywb library using pip:
pip install pywb
  1. Create a new Python script and import the necessary modules:
from pywb.recorder.recorder import WBRecorder
from pywb.webapp.pywb_init import create_wb_handler
from pywb.framework.wsgi_wrappers import WSGIApp
  1. Use the WBRecorder class to capture a web page:
recorder = WBRecorder()
recorder.record('http://example.com', 'example.warc.gz')
  1. Use the create_wb_handler function to create a WSGI application for replaying the captured web content:
app = create_wb_handler('example.warc.gz')
WSGIApp(app).run()
  1. (Optional) Use the WBIndexer class to create an index for the web archive:
indexer = WBIndexer()
indexer.index('example.warc.gz', 'example_index')

This should give you a basic understanding of how to use the pywb library to capture, replay, and index web

Competitor Comparisons

Heritrix is the Internet Archive's open-source, extensible, web-scale, archival-quality web crawler project.

Pros of Heritrix3

  • Designed for large-scale, high-performance web crawling
  • Offers advanced crawl job management and scheduling
  • Provides extensive configuration options for customized crawls

Cons of Heritrix3

  • Steeper learning curve and more complex setup
  • Less suitable for small-scale or ad-hoc archiving tasks
  • Requires more system resources to run effectively

Code Comparison

Heritrix3 (Java):

public class MyCrawlController extends AbstractFrontier {
    @Override
    public void schedule(CrawlURI curi) {
        // Custom scheduling logic
    }
}

pywb (Python):

class MyRewriter(RewriterApp):
    def rewrite_html(self, content, head_insert):
        # Custom HTML rewriting logic
        return modified_content

Summary

Heritrix3 is a powerful, enterprise-grade web crawler designed for large-scale archiving projects. It offers advanced features and extensive customization options but comes with a steeper learning curve. pywb, on the other hand, focuses on web archive replay and is more accessible for smaller-scale projects or quick setups. While Heritrix3 excels in crawling and data collection, pywb specializes in serving and manipulating archived web content.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Webrecorder pywb 2.8

.. image:: https://raw.githubusercontent.com/webrecorder/pywb/main/pywb/static/pywb-logo.png

.. image:: https://github.com/webrecorder/pywb/workflows/CI/badge.svg :target: https://github.com/webrecorder/pywb/actions .. image:: https://codecov.io/gh/webrecorder/pywb/branch/main/graph/badge.svg :target: https://codecov.io/gh/webrecorder/pywb

Web Archiving Tools for All

View the full pywb documentation <https://pywb.readthedocs.org>_

pywb is a Python 3 web archiving toolkit for replaying web archives large and small as accurately as possible. The toolkit now also includes new features for creating high-fidelity web archives.

This toolset forms the foundation of Webrecorder project, but also provides a generic web archiving toolkit that is used by other web archives, including the traditional "Wayback Machine" functionality.

New Features ^^^^^^^^^^^^

The 2.x release included a major overhaul of pywb and introduces many new features, including the following:

  • Dynamic multi-collection configuration system with no-restart updates.

  • New recording capability to create new web archives from the live web or other archives.

  • Componentized architecture with standalone Warcserver, Recorder and Rewriter components.

  • Support for Memento API aggregation and fallback chains for querying multiple remote and local archival sources.

  • HTTP/S Proxy Mode with customizable certificate authority for proxy mode recording and replay.

  • Flexible rewriting system with pluggable rewriters for different content-types.

  • Standalone, modular client-side rewriting system (wombat.js) <https://github.com/webrecorder/wombat>_ to handle most modern web sites.

  • Improved 'calendar' query UI with incremental loading, grouping results by year and month, and updated replay banner.

  • Extensible UI customizations system for modifying all aspects of the UI.

  • Robust access control system for blocking or excluding URLs, by prefix or by exact match.

  • New in 2.6: Access Control embargo and http-header control access settings.

  • New in 2.6: Support for localization and multi-language deployment.

  • New in 2.7: New banner/calendar UI written in Vue <https://vuejs.org/>_, with interactive timeline and easier theming of colors and logo via config.yaml.

Please see the full documentation <https://pywb.readthedocs.org>_ for more detailed info on all these features.

Installation for Deployment

To install pywb for usage, you can use:

pip install pywb

Note: depending on your Python installation, you may have to use pip3 instead of pip.

Installation from local copy

git clone https://github.com/webrecorder/pywb

To install from a locally cloned copy, install with pip install -e . or python setup.py install.

To run tests, we recommend installing pip install tox tox-current-env and then running tox --current-env to test in your current Python environment.

To Build docs locally, run: cd docs; make html. (The docs will be built in ./_build/html/index.html)

Running

After installation, you can run pywb or wayback.

Consult the local or online docs <https://pywb.readthedocs.org>_ for latest usage and configuration details.

Documentation

The pywb documentation is extensive. Some links to a few key guides:

  • Getting Started Guide <https://pywb.readthedocs.io/en/latest/manual/usage.html#getting-started>_

  • Embargo and Access Control Guide <https://pywb.readthedocs.io/en/latest/manual/access-control.html>_

  • Localization and Multi-Language Guide <https://pywb.readthedocs.io/en/latest/manual/localization.html>_

  • Deployment Guide <https://pywb.readthedocs.io/en/latest/manual/usage.html#deployment>_

  • OpenWayback Transition Guide <https://pywb.readthedocs.io/en/latest/manual/owb-transition.html>_

Contributions & Bug Reports

Users are encouraged to fork and contribute to this project to keep improving web archiving tools. Please consult the contributing guide <CONTRIBUTING.md>_ for information on how to contribute to pywb.