
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
A simple, fast, and elegant website screenshot tool built with Python and Playwright.
pip install webshotr
After installing WebShotr, you need to install the browser binaries:
playwright install
Take a screenshot of a website:
webshotr https://example.com
See the beautiful banner and help:
webshotr
from webshotr import WebShotr
# Create WebShotr instance
snap = WebShotr()
# Take a screenshot
snap.screenshot("https://example.com", "screenshot.png")
# Basic screenshot
webshotr https://example.com
# Custom output path
webshotr https://example.com --output my-screenshot.png
# Full page screenshot
webshotr https://example.com --full-page --output fullpage.png
# Mobile viewport
webshotr https://example.com --mobile --output mobile.png
# Custom mobile dimensions
webshotr https://example.com --width 375 --height 812 --output iphone.png
# Multiple URLs
webshotr https://google.com https://github.com --output screenshots/
# From file
webshotr --list-file urls.txt --output screenshots/
# Custom browser, quality, and delay
webshotr https://example.com \
--browser firefox \
--quality 90 \
--delay 3 \
--timeout 30
# Screenshot specific element
webshotr https://example.com \
--element "#main-content" \
--output element.png
# Use configuration file
webshotr https://example.com --config config.json
from webshotr import WebShotr, screenshot
# Quick function
screenshot("https://example.com", "output.png")
# With options
screenshot("https://example.com", "output.png",
full_page=True, mobile=True)
from webshotr import WebShotr
# Create instance with custom settings
snap = WebShotr(
width=1920,
height=1080,
browser_type="firefox",
headless=True
)
# Take screenshots
snap.screenshot("https://example.com", "desktop.png")
snap.screenshot("https://example.com", "mobile.png", mobile=True)
# Multiple URLs
urls = ["https://google.com", "https://github.com"]
results = snap.screenshot_multiple(urls, "screenshots/")
print(f"Saved {len(results)} screenshots")
import asyncio
from webshotr import WebShotr
async def take_screenshots():
async with WebShotr() as snap:
# Async screenshot
result = await snap.screenshot_async(
"https://example.com",
"async-screenshot.png"
)
print(f"Screenshot saved: {result}")
# Run async function
asyncio.run(take_screenshots())
Option | Description | Default |
---|---|---|
--output, -o | Output file path or directory | Auto-generated |
--width, -w | Viewport width | 1280 |
--height, -h | Viewport height | 720 |
--full-page, -f | Capture full page | False |
--mobile, -m | Use mobile viewport | False |
--quality, -q | JPEG quality (1-100) | Auto |
--delay, -d | Delay before screenshot (seconds) | 0 |
--element, -e | CSS selector for specific element | None |
--browser, -b | Browser engine (chromium/firefox/webkit) | chromium |
--user-agent, -ua | Custom user agent string | Auto |
--timeout, -t | Page load timeout (seconds) | 30 |
--headless/--no-headless | Run in headless mode | True |
--list-file, -l | File containing list of URLs | None |
--config, -c | JSON configuration file | None |
--verbose, -v | Verbose output | False |
Create a config.json
file:
{
"width": 1920,
"height": 1080,
"headless": true,
"timeout": 30000,
"browser_type": "chromium",
"user_agent": "Mozilla/5.0 (compatible; WebShotr/1.0)"
}
Use it with:
webshotr https://example.com --config config.json
Create a urls.txt
file:
https://example.com
https://google.com
# This is a comment
https://github.com
Use it with:
webshotr --list-file urls.txt --output screenshots/
WebShotr(
width: int = 1280,
height: int = 720,
headless: bool = True,
timeout: int = 30000,
browser_type: str = "chromium",
user_agent: Optional[str] = None
)
screenshot(url, output=None, **kwargs)
- Take a screenshotscreenshot_multiple(urls, output_dir="screenshots", **kwargs)
- Multiple screenshotsscreenshot_async(url, output=None, **kwargs)
- Async screenshotscreenshot_multiple_async(urls, output_dir="screenshots", **kwargs)
- Async multiplefrom webshotr import screenshot, screenshot_multiple
# Quick screenshot
screenshot("https://example.com", "output.png")
# Multiple screenshots
screenshot_multiple(urls, "screenshots/")
# Clone the repository
git clone https://github.com/abderrahimghazali/webshotr.git
cd webshotr
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Install development dependencies
pip install pytest pytest-asyncio flake8
# Install Playwright browsers
playwright install
# Run all tests
pytest tests/ -v
# Run specific test file
pytest tests/test_cli.py -v
# Run with coverage
pytest tests/ --cov=webshotr
# Check code style
flake8 webshotr/ tests/
# Format code (if you have black installed)
black webshotr/ tests/
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)Made with ❤️ by AbderrahimGHAZALI
FAQs
A simple and fast website screenshot tool - WebShotr
We found that webshotr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.