Skip to content

Instantly share code, notes, and snippets.

@vbarbarosh
Last active April 16, 2019 18:17
Show Gist options
  • Select an option

  • Save vbarbarosh/1f5548235c683590dabd4b088c94fada to your computer and use it in GitHub Desktop.

Select an option

Save vbarbarosh/1f5548235c683590dabd4b088c94fada to your computer and use it in GitHub Desktop.
shell_docker_browserless_screencast – Make a screencast of a page using Browserless https://codescreens.com
#!/bin/bash
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o nounset -o errexit -o pipefail
# Make a screencast of a page usign Browserless
curl -sf https://chrome.browserless.io/screencast \
-H Content-Type:application/javascript \
-o a1.webm --data-binary @- << 'EOF'
module.exports = async function ({page}) {
await page.goto('https://www.youtube.com/watch?v=u2oKnsiXBr8');
await page.waitFor(5000);
};
EOF
docker run --rm -i browserless/chrome bash << 'EOF' > a2.webm
node build/index.js &
while ! curl -sf 127.0.0.1:3000/workspace -o /dev/null; do sleep 0.2s; done
curl -sf 127.0.0.1:3000/screencast -H Content-Type:application/javascript \
-o /dev/stdout --data-binary @- << 'EOF2'
module.exports = async function ({page}) {
await page.goto('https://www.youtube.com/watch?v=u2oKnsiXBr8');
await page.waitFor(5000);
};
EOF2
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment