Last active
April 17, 2024 22:32
-
-
Save szupie/adb79f049966234c622f46ecd8342b81 to your computer and use it in GitHub Desktop.
Bash script to save full-page screenshots of a list of URLs, using Firefox in headless mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to save full-page screenshots of a list of URLs, using Firefox in headless mode | |
# Run with path to file containing list of URLs as first argument: | |
# sh ./path/to/screenshotter.sh ./path/to/urls.txt | |
# Screenshots will be saved to a folder named the specified width | |
# Change these to desired screenshot width and path to Firefox | |
WIDTH=1440 | |
FIREFOX_PATH="/Applications/Firefox.app/Contents/MacOS/firefox" | |
mkdir $WIDTH | |
for url in $(cat $1); do | |
FILENAME=$(basename $url) | |
FILENAME="./${WIDTH}/${FILENAME}-$(date +%s)-${WIDTH}.png" | |
$FIREFOX_PATH -P default -screenshot $url --window-size=$WIDTH | |
mv ./screenshot.png $FILENAME | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment