Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active September 24, 2017 09:28
Show Gist options
  • Save dardo82/82825c9d85c7b3a1686009ea81b99705 to your computer and use it in GitHub Desktop.
Save dardo82/82825c9d85c7b3a1686009ea81b99705 to your computer and use it in GitHub Desktop.
FaceBook photo DL
#!/bin/bash
shopt -s expand_aliases; fb=https://m.facebook.com; open $fb/$1/photos; sleep 10
function safari-cli { eval osascript -e \'tell application \"Safari\" to $1\'; }
alias sst='safari-cli "get source of current tab of front window"'
alias sct='safari-cli "close current tab of front window"'
sst | tr \" \\n | grep ^/.*42$ | cut -d\& -f1 | xargs -I {} open $fb{}; sleep 10
mkdir $1; cd $1; for page in {01..40}; do URL=$(sst | tr \" \\n | grep -B1 Size\
| sed -E "s/amp;|\\\//g;q"); curl -v -o $(basename ${URL%\?*}) "$URL"; sct; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment