Last active
December 5, 2018 16:55
-
-
Save iDemonix/8091da8a782bbb25fdc0b11fbc34f776 to your computer and use it in GitHub Desktop.
check_instagram.sh
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 | |
# check_instagram.sh | |
# fetches simple stats about a given username for icinga2 | |
# [email protected] - 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