-
-
Save mattn/0380def6f15a6ff0da2c66276bd774be to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
declare -A hashmap | |
PUBKEY=2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc | |
curl -s "https://api.nostr.wine/search?kind=1&pubkey=$PUBKEY" | \ | |
jq -r '.data[] | [.pubkey, .content] | @tsv' | while IFS=$'\t' read -r pubkey value; do | |
NAME=${hashmap[$pubkey]} | |
if [ -z "$NAME" ]; then | |
NAME=$(curl -s "https://api.nostr.wine/search?kind=0&pubkey=$pubkey" | jq -r '.data[0].content | fromjson.display_name') | |
if [ -z "$NAME" ]; then | |
hashmap[$pubkey]=unknown | |
else | |
hashmap[$pubkey]=$NAME | |
fi | |
fi | |
echo -e "$NAME: $value" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment