Skip to content

Instantly share code, notes, and snippets.

@denny0223 denny0223/main.sh
Created Oct 1, 2015

Embed
What would you like to do?
FB message count ranking
token=''
res=$(curl -s "https://graph.facebook.com/v2.0/fql?access_token=$token&debug=all&format=json&method=get&pretty=0&q=SELECT%20viewer_id%2Crecipients%2Cmessage_count%20FROM%20thread%20WHERE%20folder_id%20%3D%200%20ORDER%20BY%20message_count%20DESC&suppress_http_code=1")
data=$(echo $res | jq '.data')
for i in $(seq 0 $(($(echo $data | jq '. | length') - 1)))
do
echo No. $((i + 1))
echo $data | jq ".[$i].message_count"
for fbid in $(echo $data | jq ".[$i].recipients[1:] | .[]")
do
fbid=$(echo $fbid | awk -F\" '{print $2}')
curl -s https://graph.facebook.com/$fbid?access_token=$token | jq '.name'
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.