Skip to content

Instantly share code, notes, and snippets.

@betafcc
Last active August 22, 2018 08:00
Show Gist options
  • Save betafcc/9af843e4e5fed429c52cc77c0598e524 to your computer and use it in GitHub Desktop.
Save betafcc/9af843e4e5fed429c52cc77c0598e524 to your computer and use it in GitHub Desktop.
Take screenshot from all urls in a file
npm i -g slugify-cli
npm i -g puppeteer-screenshot-cli
print_all() {
urls="$1"
output="$2"
mkdir -p "${output}"
cat "${urls}" |
while read line
do
echo printing "${line}"
puppeteer-screenshot \
--url "${line}" \
--output ${output}/$(slugify "${line}").jpg \
-w 1024 -h 768
done
}
print_all "$1" "$2"
# usage: sh screenshot_all.sh <urls_file> <output_dir>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment