How timf34/pagesource works
pagesource is a command-line webpage resource capture tool. A user supplies a URL and options; the CLI validates the URL, asks a headless browser to load the page and collect successful network responses, then saves eligible resources under host and URL-path directories. The saver handles external-resource filtering, inferred extensions, path safety, and duplicate names. The README documents these capabilities; the sampled source shows the main call flow, while browser internals are represented at the component level.
Main entry points: cli.py CLI command · browser.py Browser capture · downloader.py Resource saver · utils.py URL validation
Components 9
Command orchestration
- CLI command
src/pagesource/cli.py - URL validation
src/pagesource/utils.py
Page capture
- Browser capture
src/pagesource/browser.py - Captured resources
src/pagesource/browser.py
Resource output
- Resource saver
src/pagesource/downloader.py - Path and MIME utilities
src/pagesource/utils.py
Other components
- CLI user
- Target webpage
- Saved resource files
Connections 9
- CLI user → CLI command: provides URL
README.md - CLI command → URL validation: validates with
src/pagesource/cli.py - CLI command → Browser capture: requests capture
src/pagesource/cli.py - Browser capture → Target webpage: loads page
README.md - Target webpage → Browser capture: serves responses
README.md - Browser capture → Captured resources: collects bodies
src/pagesource/browser.py - CLI command → Resource saver: saves resources
src/pagesource/cli.py - Resource saver → Path and MIME utilities: derives paths
src/pagesource/downloader.py - Resource saver → Saved resource files: writes files
src/pagesource/downloader.py