Skip to content

Instantly share code, notes, and snippets.

@iDemonix
Last active December 5, 2018 16:55
Show Gist options
  • Save iDemonix/8091da8a782bbb25fdc0b11fbc34f776 to your computer and use it in GitHub Desktop.
Save iDemonix/8091da8a782bbb25fdc0b11fbc34f776 to your computer and use it in GitHub Desktop.
check_instagram.sh
#!/bin/bash
# check_instagram.sh
# fetches simple stats about a given username for icinga2
# dan@danwalker.com - 2018-12
if [[ $# -eq 0 ]] ; then
echo 'Please specify a username, example: ./check_instagram.sh danwritescode'
exit 0
fi
CONTENT=`curl -s https://www.instagram.com/$1/ | grep "meta content"`
PARSED=$(echo $CONTENT | awk -F "\"" '{print $2}')
FOLLOWERS=$(echo $PARSED | awk -F " " '{print $1}')
FOLLOWING=$(echo $PARSED | awk -F " " '{print $3}')
POSTS=$(echo $PARSED | awk -F " " '{print $5}')
echo "$FOLLOWERS Followers, $FOLLOWING Following, $POSTS Posts | followers=$FOLLOWERS following=$FOLLOWING posts=$POSTS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment