Last active
November 20, 2022 10:15
-
-
Save michael-simons/ef3043c02107496cb93c7ad108e6d995 to your computer and use it in GitHub Desktop.
Some jq fun
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
# Most interactions / mentions, excluding myself. | |
{ sed -e '1s/.*/[/' -e '$d' tweets.js && sed '1s/.*/,/' tweets-part1.js; } | \ | |
jq ' | |
[.[].tweet.entities.user_mentions[] | select(.screen_name != "rotnroll666") | {handle: .screen_name}] | | |
group_by(.handle) | map(.[0] + {"count": length}) | | |
sort_by(-.count,.handle|=ascii_downcase) | limit(20;.[]) | | |
"@\(.handle) (\(.count))" | |
' | |
# "Best" tweets by RT (turns out, that retweets are in the archive, but prefixed only with RT @... | |
# and not a proper info | |
{ sed -e '1s/.*/[/' -e '$d' tweets.js && sed '1s/.*/,/' tweets-part1.js; } | \ | |
jq -r ' | |
[.[] | select(.tweet.full_text | startswith("RT @") | not)] | | |
sort_by(.tweet.retweet_count|tonumber) |reverse | limit(3;.[]) | | |
"\(.tweet.retweet_count|tonumber): https://twitter.com/rotnroll666/status/\(.tweet.id_str)" | |
' | |
# Same but by fav | |
{ sed -e '1s/.*/[/' -e '$d' tweets.js && sed '1s/.*/,/' tweets-part1.js; } | \ | |
jq -r ' | |
[.[] | select(.tweet.full_text | startswith("RT @") | not)] | | |
sort_by(.tweet.favorite_count|tonumber) |reverse | limit(3;.[]) | | |
"\(.tweet.favorite_count|tonumber): https://twitter.com/rotnroll666/status/\(.tweet.id_str)" | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment