A collection of helpful automation scripts.
Takes screenshots of every page listed in a website's sitemap.xml file.
npm installBasic usage:
node screenshot-sitemap.js https://example.com/sitemap.xmlWith options:
# Custom output directory and viewport size
node screenshot-sitemap.js https://example.com/sitemap.xml -o ./my-screenshots -w 1280 -h 720
# Add delay between screenshots (helpful for rate limiting)
node screenshot-sitemap.js https://example.com/sitemap.xml --delay 1000
# Save as JPEG instead of PNG
node screenshot-sitemap.js https://example.com/sitemap.xml --format jpeg
# Capture viewport only (not full page)
node screenshot-sitemap.js https://example.com/sitemap.xml --no-fullpage
# Exclude blog posts and category pages
node screenshot-sitemap.js https://example.com/sitemap.xml --exclude /blogpost --exclude /category
# Exclude multiple patterns (can use -e or --exclude)
node screenshot-sitemap.js https://example.com/sitemap.xml -e /blog -e /tag -e /category--output, -o- Output directory (default:./screenshots)--width, -w- Viewport width in pixels (default:1920)--height, -h- Viewport height in pixels (default:1080)--delay, -d- Delay in milliseconds between screenshots (default:0)--format, -f- Image format:pngorjpeg(default:png)--exclude, -e- Exclude URLs containing this pattern (can be used multiple times)--no-fullpage- Capture viewport only instead of full page
- ✅ Supports standard sitemap.xml format
- ✅ Handles sitemap index files (nested sitemaps)
- ✅ Full page screenshots by default
- ✅ Configurable viewport size
- ✅ Rate limiting with delay option
- ✅ Progress tracking with detailed output
- ✅ Error handling for failed pages
- ✅ Sanitized filenames for screenshots
Screenshots are saved with numbered filenames based on the URL:
screenshots/
1_example_com_page1.png
2_example_com_page2.png
3_example_com_blog_article.png
...
- Node.js 14 or higher
- Puppeteer will download Chromium automatically on first install