Skip to main content

pagesource

A Python CLI tool that captures all resources loaded by a webpage (like browser DevTools Sources tab) and saves them with the original directory structure.

Installation

pip install pagesource

# IMPORTANT: Install Playwright browser after package installation
playwright install chromium

Usage

Basic Usage

# Capture all resources from a webpage
pagesource https://example.com

This will save all resources to ./pagesource_output/ with the directory structure preserved.

Options

# Specify custom output directory
pagesource https://example.com -o ./my-output

# Wait extra time for JavaScript content (useful for SPAs)
pagesource https://example.com --wait 5

# Include external resources (CDN assets, third-party scripts)
pagesource https://example.com --include-external

# Combine options
pagesource https://example.com -o ./output --wait 3 --include-external

CLI Reference

pagesource <url> [OPTIONS]

Arguments:
  url                     URL of the webpage to capture resources from

Options:
  -o, --output PATH       Output directory (default: ./pagesource_output)
  -w, --wait INTEGER      Additional seconds to wait after page load
  -e, --include-external  Include external resources (CDN, third-party)
  -v, --version           Show version and exit
  --help                  Show help message

Output Structure

Resources are saved preserving the URL path structure:

pagesource_output/
  example.com/
    index.html
    assets/
      css/
        style.css
      js/
        app.js
    images/
      logo.png

If --include-external is used, external resources are saved in their own host directories:

pagesource_output/
  example.com/
    ...
  cdn.example.com/
    libs/
      library.js
  fonts.googleapis.com/
    css/
      font.css

Features

  • Captures all network resources loaded by the page (HTML, CSS, JS, images, fonts, etc.)
  • Preserves original directory structure
  • Handles query strings (strips them from filenames)
  • Infers file extensions from Content-Type when missing
  • Handles duplicate filenames
  • Sanitizes paths for filesystem safety
  • Optional wait time for JavaScript-heavy pages

Requirements

  • Python 3.10+
  • Playwright (with Chromium browser)

License

MIT

Release files for pagesource 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pagesource 0.1.2
File Size Uploaded
pagesource-0.1.2.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pagesource 0.1.2
File Interpreter ABI Platform
pagesource-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / pagesource-0.1.2.tar.gz

Download URL pagesource-0.1.2.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d355b323ec959b7bcea65bfc8cca4409442823a81c66c81f0a6d337bb3f9fcdb
BLAKE2b-256 checksum
How to use checksums
36b7f433ab420b96a96f18013e6db7580716c69bb6ddd980284898a494f5d41d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / pagesource-0.1.2-py3-none-any.whl

Download URL pagesource-0.1.2-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31cda7a4e5e645c2bdeb2599d6c9c4d898909a75b7d899544fb6991e41e616a5
BLAKE2b-256 checksum
How to use checksums
dca0e6ee41cae56f6ebfee17e2a17022cf9505dedc0f1bc8d133e1d53b025124
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page