Enable screenshots by default, --no-screenshot to disable

This commit is contained in:
Russell Ballestrini 2025-12-30 15:21:41 -05:00
parent 905760bb7e
commit 16f869d7de
4 changed files with 19 additions and 16 deletions

View file

@ -194,11 +194,11 @@ neopig supports multiple screenshot backends via uri2png. Auto-detects the light
python neopig.py --list-engines
# Use specific engine
python neopig.py https://example.com --screenshot --screenshot-engine wkhtmltoimage
python neopig.py https://example.com --screenshot-engine wkhtmltoimage
python archive.py https://example.com --screenshot-engine cutycapt
# Auto-detect (default) - picks lightest available
python neopig.py https://example.com --screenshot
# Disable screenshots
python neopig.py https://example.com --no-screenshot
```
**Recommendation:** Install `wkhtmltopdf` for fast, lightweight screenshots without browser downloads.
@ -221,8 +221,11 @@ python neopig.py https://example.com --depth 5 --max-pages 500
# Index only (no download)
python neopig.py https://example.com --no-download
# Enable screenshots (requires uri2png)
python neopig.py https://example.com --screenshot --screenshot-width 1920 --screenshot-height 1080
# Custom screenshot viewport (screenshots enabled by default)
python neopig.py https://example.com --screenshot-width 1920 --screenshot-height 1080
# Disable screenshots
python neopig.py https://example.com --no-screenshot
# Backfill markdown with absolute URLs (after crawl, fixes image hydration)
python neopig.py --backfill-markdown example.com --db data/neopig.db

View file

@ -44,11 +44,11 @@ python neopig.py https://example.com --depth 5 --max-pages 500 --mode images
# Index URLs without downloading
python neopig.py https://example.com --no-download --mode images
# Enable page screenshots (requires uri2png)
python neopig.py https://example.com --mode images --screenshot
# Disable page screenshots (on by default, requires uri2png)
python neopig.py https://example.com --mode images --no-screenshot
# Screenshots with custom viewport
python neopig.py https://example.com --mode images --screenshot --screenshot-width 1920 --screenshot-height 1080
python neopig.py https://example.com --mode images --screenshot-width 1920 --screenshot-height 1080
```
### Options
@ -68,8 +68,8 @@ optional arguments:
--no-download Don't download media, just index URLs
-v, --verbose Verbose output
screenshot options (all off by default, requires uri2png):
--screenshot Enable page screenshots
screenshot options (on by default, requires uri2png):
--no-screenshot Disable page screenshots
--screenshot-width Viewport width in pixels (default: 1280)
--screenshot-height Viewport height in pixels (default: 1024)
--screenshot-delay Delay after page load in ms (default: 1000)

View file

@ -1553,11 +1553,11 @@ async def main():
help="Verbose output"
)
# Screenshot options (all off by default)
# Screenshot options (on by default)
parser.add_argument(
"--screenshot",
"--no-screenshot",
action="store_true",
help="Enable page screenshots (requires uri2png)"
help="Disable page screenshots"
)
parser.add_argument(
@ -1754,14 +1754,14 @@ async def main():
# Create screenshot config from args
screenshot_config = ScreenshotConfig(
enabled=args.screenshot,
enabled=not args.no_screenshot,
width=args.screenshot_width,
height=args.screenshot_height,
delay=args.screenshot_delay,
engine=args.screenshot_engine,
)
if args.screenshot:
if not args.no_screenshot:
engine_info = f", engine={args.screenshot_engine}" if args.screenshot_engine else " (auto-detect)"
logger.info(f"Screenshots enabled: {screenshot_config.width}x{screenshot_config.height}, delay={screenshot_config.delay}ms{engine_info}")

View file

@ -55,7 +55,7 @@ NATIVE_ENGINES = {'wkhtmltoimage', 'cutycapt'}
@dataclass
class ScreenshotConfig:
"""Screenshot capture configuration."""
enabled: bool = False
enabled: bool = True
width: int = 1024
height: int = 768
delay: int = 1000 # ms after DOM load