Skip to content

Instantly share code, notes, and snippets.

@richinseattle
Created November 18, 2024 09:41
Show Gist options
  • Save richinseattle/658ece0bfdbeeaab42481015918a2447 to your computer and use it in GitHub Desktop.
Save richinseattle/658ece0bfdbeeaab42481015918a2447 to your computer and use it in GitHub Desktop.
Cache all Bluesky DID -> Handle mappings
while true; do timeout 5 websocat "wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post" | grep '"handle"' > /tmp/jetstream.log 2>/dev/null | grep -v Terminated ; head -n -1 /tmp/jetstream.log | jq '.identity | .did, .handle | values' | tr -d '"' | paste -d " " - - | while read did handle; do echo -e "$did -> $handle"; redis-cli SET $handle $did > /dev/null ; redis-cli SET $did $handle > /dev/null; done ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment