Created
October 1, 2015 15:21
-
-
Save denny0223/47895bbd2449a901dfa1 to your computer and use it in GitHub Desktop.
FB message count ranking
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
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