search-rentry.sh

echo "## $1 images"
echo 'page content auto generated from nostr with command [./search-rentry.sh](/search-rentry) "'$1'"'

cols=4

wscat -c wss://cache2.primal.net/v1 -x '["REQ","search",{"cache":["search",{"query":"'$1'","limit":1000}]}]' > res.tmp

function cols(){
  i=0
  for i in $(seq 1 $1)
  do
    echo -n "$2"
    [ $(( $i % $1 )) -ne 0 ] && echo -n ' | ' || echo ''
    let i++
  done
}

cols $cols " "
cols $cols "---"

i=0
cat res.tmp | grep -oP "http(s|)://[^\" ]+?\.(jpg|jpeg|png|webp)" | grep -v "(\.onion/" | grep -v "favicon" | grep -v "social-image" | grep -v "logo-small-og" | grep -v "logo-new" | sort | uniq | while read img
do
  let i++
  echo -n '[![img]('$img')]('$img')'
  #echo -n '![img]('$img')'
  [ $(( $i % $cols )) -ne 0 ] && echo -n ' |' || echo ''
done
Edit Report
Pub: 02 Sep 2023 00:11 UTC
Edit: 02 Sep 2023 00:47 UTC
Views: 543