Created
January 26, 2019 18:22
-
-
Save rolandcrosby/5049bed6c59f0f7f9a0048b359cedf44 to your computer and use it in GitHub Desktop.
search your twitter archives
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
#!/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