2 unstable releases
new 0.2.0 | Apr 17, 2025 |
---|---|
0.1.0 | Apr 16, 2025 |
#1654 in Web programming
61 downloads per month
32KB
192 lines
Photonos
Photonos is a wget-like tool that can render JavaScript-powered websites using a headless browser, allowing you to capture the fully rendered HTML content and take screenshots of modern web applications.
Installation
Once the requirements are met (see Requirements section below), you can install Photonos directly from crates.io:
cargo install photonos
Usage
Photonos works similar to wget, but with JavaScript rendering:
photonos https://example.com -o output.html --screenshot screenshot.png
Requirements
Photonos has two main dependencies:
1. Chrome/Chromium
Chrome or Chromium is required as it's the browser engine used for rendering web pages. Install it for your distribution:
Debian / Ubuntu
sudo apt-get update
sudo apt-get install -y chromium-browser
Fedora
sudo dnf install -y chromium
Arch Linux
sudo pacman -S chromium
2. Rust and Cargo
Rust and Cargo are needed to build and install Photonos:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
Why does Photonos need Chromium?
Photonos uses chromiumoxide, a pure Rust library to control the Chrome/Chromium browser. This allows it to:
- Render modern web pages with JavaScript support
- Take screenshots exactly as they would appear in a browser
- Interact with dynamic content
The pure Rust approach leverages the power of modern browser rendering while maintaining the performance benefits of Rust.
Troubleshooting
If you can't run Photonos after installation, make sure that Cargo's bin directory is in your PATH:
export PATH="$HOME/.cargo/bin:$PATH"
For persistent configuration, add this line to your ~/.bashrc
, ~/.zshrc
, or equivalent shell configuration file.
Dependencies
~12–27MB
~432K SLoC