Why Nostr? What is Njump?
2024-07-02 23:25:21

npub106…jhf35 on Nostr: commit 17baf2bd03e59172f2d9cfd4b59cd6fd532c3d73 Author: randymcmillan ...

commit 17baf2bd03e59172f2d9cfd4b59cd6fd532c3d73
Author: randymcmillan <[email protected]>
Date: Mon May 20 19:49:35 2024 -0400

nostril-query

diff --git a/nostril-query b/nostril-query
new file mode 100755
index 000000000..4227352dd
--- /dev/null
+++ b/nostril-query
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+
+import sys
+import argparse
+import json
+
+parser = argparse.ArgumentParser(prog = 'nostril-query', description = 'Construct nostr queries')
+parser.add_argument('-a', '--authors')
+parser.add_argument('-p', '--mentions')
+parser.add_argument('-e', '--references')
+parser.add_argument('-t', '--hashtag')
+parser.add_argument('-i', '--ids')
+parser.add_argument('-k', '--kinds')
+parser.add_argument('-g',
+ '--generic',
+ nargs=2,
+ metavar=('tag', 'value'),
+ help="Generic tag query: `#<tag>: value`")
+parser.add_argument('-l', '--limit', type=int)
+
+def usage():
+ parser.print_help()
+ sys.exit(1)
+
+args = parser.parse_args()
+
+filt = {}
+
+if args.authors:
+ filt["authors"] = args.authors.split(",")
+
+if args.ids:
+ filt["ids"] = args.ids.split(",")
+
+if args.limit is not None:
+ filt["limit"] = args.limit
+
+if args.generic:
+ (tag, val) = args.generic
+ filt["#" + tag] = val.split(",")
+
+if args.hashtag is not None:
+ filt["#t"] = args.hashtag.split(",")
+
+if args.mentions is not None:
+ filt["#p"] = args.mentions.split(",")
+
+if args.references is not None:
+ filt["#e"] = args.references.split(",")
+
+if args.kinds is not None:
+ kinds = args.kinds.split(",")
+ filt["kinds"] = [a for a in map(lambda s: int(s), kinds)]
+
+q = json.dumps(["REQ","nostril-query",filt])
+print(q)
Author Public Key
npub1066exl5kzdmcuaqg3u084qht00kmzz7a4n40eflwgyll49a2dt6svjhf35