ScreenShooter is a simple, automated website screenshot tool built using Node.js and Puppeteer. It reads website URLs from a CSV file and captures full-page screenshots, saving them locally.
- Reads website URLs from a CSV file
- Captures full-page screenshots with a customizable width
- Saves screenshots in a designated folder
- Supports environment variable configuration
- Automatically creates necessary directories
- Error handling with detailed logging
- Node.js 14.0 or higher
- 4GB RAM minimum (8GB recommended for large websites)
- Storage space for screenshots (varies based on usage)
- Node.js installed
npm install
Create a .env
file in the project root directory to customize settings:
SCREENSHOT_WIDTH=1440 # Width of the viewport in pixels
HEADLESS_MODE=true # Run browser in headless mode
TIMEOUT=60000 # Maximum time (ms) to wait for page load
CSV_FILE=websites.csv # Input CSV filename
OUTPUT_DIR=screenshots # Output directory for screenshots
SCREENSHOT_WIDTH
: Sets the viewport width for screenshots (default: 1440px)HEADLESS_MODE
: When true, runs browser without GUI (default: true)TIMEOUT
: Maximum time to wait for a page to load in milliseconds (default: 60000)CSV_FILE
: Name of the input CSV file (default: websites.csv)OUTPUT_DIR
: Directory where screenshots will be saved (default: screenshots)
Copy the example file and edit it:
# On Unix/Linux/MacOS
cp websites.example.csv websites.csv
# On Windows (Command Prompt)
copy websites.example.csv websites.csv
Edit websites.csv
with your own list of websites in this format:
name,url
VS Code,https://code.visualstudio.com/
GitHub,https://github.com/
Postman,https://www.postman.com/
Execute the following command:
# On Unix/Linux/MacOS/Windows
node screenshot.js
# On Windows (PowerShell)
node .\screenshot.js
Captured screenshots will be saved in the screenshots/
folder (or the folder specified in .env
).
- Screenshots are captured after the page reaches the
networkidle2
state (when there are no more than 2 network connections for at least 500ms) - Failed screenshots are logged to console but won't stop the process
- The tool automatically adjusts screenshot height based on page content
- Screenshots are saved as PNG files using the 'name' field from the CSV as the filename
- The 'name' field in the CSV is used directly as the filename - avoid special characters
- Very long pages might require increased memory allocation
- Some websites might block automated access
- Dynamic content loading might require additional wait time
-
Memory Issues
# Increase Node.js memory limit node --max-old-space-size=4096 screenshot.js
-
Timeout Errors
- Increase the TIMEOUT value in .env
- Check internet connection
- Some websites might be blocking automated access
-
Blank Screenshots
- Try increasing the TIMEOUT value
- Check if the website requires authentication
- Verify the website doesn't block automated access
-
File Permission Errors
- Ensure write permissions in the output directory
- Try running with administrator/sudo privileges if needed
- Basic websites: 50-100MB per page
- Complex websites: 200-500MB per page
- Running multiple screenshots: Consider limiting concurrent operations
- For batch processing: Allow 2-4GB of available RAM
Edit the .env
file to change the width:
SCREENSHOT_WIDTH=1920
Increase the timeout for slower websites:
TIMEOUT=120000
- Add CLI arguments for dynamic CSV file input
- Implement scheduled screenshot captures
- Generate reports of captured screenshots
- Add support for authentication
- Add retry mechanism for failed screenshots
- Implement filename sanitization
This project is licensed under the MIT License.
Feel free to open issues or submit pull requests to improve ScreenShooter!
If you encounter any issues or need assistance:
- Check the Troubleshooting section
- Open an issue on GitHub
- Review existing issues for similar problems