Skip to content

Instantly share code, notes, and snippets.

@rolandcrosby
Created January 26, 2019 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolandcrosby/5049bed6c59f0f7f9a0048b359cedf44 to your computer and use it in GitHub Desktop.
Save rolandcrosby/5049bed6c59f0f7f9a0048b359cedf44 to your computer and use it in GitHub Desktop.
search your twitter archives
#!/usr/bin/env bash
# expects you to have your twitter archive folders in $dir
# with folder names like "acct1 2019-01-26" so they sort nicely
set -euo pipefail
dir='path/to/archives'
accts='acct1 acct2'
query="$*"
for acct in $accts; do
latest="$(find "$dir" -name "${acct}*" -type d -depth 1 | tail -1)/tweet.js"
echo "***** $latest *****"
sed -e '1 s/.*= //' "$latest" |
jq -r ".[] | select(.full_text | match(\"$query\"; \"i\")) | \"https://twitter.com/$acct/statuses/\" + .id_str, .full_text, \"\""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment