Skip to main content

No project description provided

Project description

Python Version License Ruff Tests Codecov Discord

WebCap is an extremely lightweight headless browser tool capable of web screenshots and more. It doesn't require Selenium, Playwright, Puppeteer, or any other browser automation framework; all it needs is a working Chrome installation.

pipx install webcap

WebCap's most unique feature is its ability to capture not only the fully-rendered DOM, but also every snippet of parsed Javascript (regardless of inline or external), and the full response body of every HTTP request. For convenience, it outputs directly to JSON:

Fully-rendered DOM

image

Javascript Capture

image

Requests + Responses

All features:

  • Blazing fast screenshots
  • JSON output
  • Full DOM extraction
  • Javascript extraction (inline + external)
  • Javascript extraction (environment dump)
  • Full network logs (incl. request/response bodies)
  • Status code
  • Title
  • Fuzzy hashing
  • Technology detection
  • OCR text extraction
  • Full network logs

Example Usage - CLI

webcap -u http://example.com urls.txt -o ./my_screenshots

Example Usage - Python

import base64
from webcap import Browser

async def main():
    # create a browser instance
    browser = Browser()
    # start the browser
    await browser.start()
    # take a screenshot
    webscreenshot = await browser.screenshot("http://example.com")
    # save the screenshot to a file
    with open("screenshot.png", "wb") as f:
        f.write(webscreenshot.blob)
    # stop the browser
    await browser.stop()

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

CLI Usage (--help)

usage: webcap [-h] [-u URLS [URLS ...]] [-o OUTPUT] [-r RESOLUTION] [-f] [-t THREADS]
              [--delay DELAY] [-U USER_AGENT] [-H HEADERS [HEADERS ...]] [-p PROXY]
              [-b] [-j] [-d] [-Rs] [-Rq] [-J] [-s] [--debug] [--no-color] [-c CHROME]

options:
  -h, --help            show this help message and exit
  -u URLS [URLS ...], --urls URLS [URLS ...]
                        URL(s) to capture, or file(s) containing URLs

Output:
  -o OUTPUT, --output OUTPUT
                        Output directory
  -r RESOLUTION, --resolution RESOLUTION
                        Resolution to capture
  -f, --full-page       Capture the full page (larger resolution images)

Performance:
  -t THREADS, --threads THREADS
                        Number of threads to use
  --delay DELAY         Delay before capturing (default: 3.0 seconds)

HTTP:
  -U USER_AGENT, --user-agent USER_AGENT
                        User agent to use
  -H HEADERS [HEADERS ...], --headers HEADERS [HEADERS ...]
                        Additional headers to send in format: 'Header-Name: Header-
                        Value' (multiple supported)
  -p PROXY, --proxy PROXY
                        HTTP proxy to use

JSON Output:
  -b, --base64          Output each screenshot as base64
  -j, --json            Output JSON
  -d, --dom             Capture the fully-rendered DOM
  -Rs, --responses      Capture the full body of each HTTP response (including API
                        calls etc.)
  -Rq, --requests       Capture the full body of each HTTP request (including API
                        calls etc.)
  -J, --javascript      Capture every snippet of Javascript (inline + external)

Misc:
  -s, --silent          Silent mode
  --debug               Enable debugging
  --no-color            Disable color output
  -c CHROME, --chrome CHROME
                        Path to Chrome executable

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

webcap-0.1.10.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

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

webcap-0.1.10-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file webcap-0.1.10.tar.gz.

File metadata

  • Download URL: webcap-0.1.10.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.21

File hashes

Hashes for webcap-0.1.10.tar.gz
Algorithm Hash digest
SHA256 5324a9f5d8941a1ae3a7ab875da04d92e637494f6067558d226d0531629df80e
MD5 45ba12bb9ccbde537d05345c28266f06
BLAKE2b-256 7344361c01a748ccafddb2df02272a44ac117635adbd17360cc690a97641a93a

See more details on using hashes here.

File details

Details for the file webcap-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: webcap-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.21

File hashes

Hashes for webcap-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c163009c17cce6f5b5fe36299ae27f000e57e4fc6ce186ac7bdf174136c85d
MD5 fcdc306f0cdc557396fb5b4235f7163b
BLAKE2b-256 2660ac6eb5bd83aa1bcd021edea6b7f16029406d623a3e9c3cab21dff74c51bb

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