~ 1 min read

How to Search Your Entire Twitter Archive With One Line of jq

If you’ve downloaded your twitter archive (which a lot of us a doing right now), it’s possible to search it very simply with jq since it’s just a large json array.

Unzip your archive, rename the tweets.js to json and remove the window bind within. My 15 Year archive is about 21k tweets in a single 1M line long file. If you’ve tweeted a lot - you may have multiple tweets files and need to concatenate them together. Then run the following command, replacing <your_twitter_handle> with your handle:

cat tweets.json | jq '[.[].tweet | {
    retweets: .retweet_count | tonumber,
    favourites: .favorite_count | tonumber,
    text: .full_text,
    url: "https://twitter.com/<your_twitter_handle>/status/\(.id)" 
}] | sort_by(.retweets)'

This takes your entire history and orders by the number of retweets you’ve received. Adjust to order by your favourites if you like and enjoy looking over tweets people have enjoyed most.

Subscribe for Exclusives

My monthly newsletter shares exclusive articles you won't find elsewhere, tools and code. No spam, unsubscribe any time.