Skip to content
Melvin Carvalho edited this page Aug 1, 2024 · 9 revisions

jq

get the content from a stream

jq '.[] | select(type == "object" and has("content")) | .content'

get profile from a relay

echo '["REQ", "x", {"kinds":[0,2,10002], "authors": ["de7ecd1e2976a6adb2ffa5f4db81a7d812c8bb6698aa00dcf1e76adb55efd645"]}]' | timeout 2 websocat -n --ping-interval 20 <RELAY>

update relays 10002 for a PRIVKEY

time for i in $(curl https://api.nostr.watch/v1/online | jq -r '.[]') ; do nak event -c "" -t r=wss://nostr-pub.wellorder.net/ -t r=wss://relay.damus.io/ -t r=wss://relay.primal.net/ -t r=wss://relay.snort.social/  -t r=wss://nostr.lol/ -t r=wss://nostr.rocks/ -t r=wss://nostr.mom   --kind 10002 --sec PRIVKEY  ; done

firehose (use sparingly)

echo '["REQ", "x", {"kinds":[1], "limit": 0}]' | websocat -n --ping-interval 20 wss://relay.damus.io | while read -r line
do     
  echo $line | jq -r '.[2].pubkey' ;
  content=$(echo $line | jq  '.[2].content') ;
  echo -e "$content";     
  echo; 
done

send note to relays

 /home/melvin/go/bin/nak event -c "test command line note" --kind 1   --sec "$PRIVKEY"  wss://npub.info wss://relay.damus.io wss://nos.lol wss://relay.primal.net wss://a.nos.lol wss://relay.nostr.band wss://offchain.pub wss://relay.mostr.pub

Clone this wiki locally