summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-06-06 19:42:09 -0400
committerrsiddharth <s@ricketyspace.net>2019-06-06 19:42:09 -0400
commitf5f5b6b4929a4f907e65bc3d762f55877a7c5012 (patch)
tree049ab002ea734a81610961dd6d5e2acdc4e458b0
parent68ec686a93b5e461a1bcf14b00c6ecdda4af87d1 (diff)
hn/g: Add athing:id.
hn/g (athing:id): New function.
-rwxr-xr-xhn/g6
1 files changed, 6 insertions, 0 deletions
diff --git a/hn/g b/hn/g
index 8432cad..ae80410 100755
--- a/hn/g
+++ b/hn/g
@@ -14,6 +14,7 @@
(require openssl)
(require html-parsing)
+(require sxml)
(require sxml/sxpath)
@@ -34,3 +35,8 @@
(s (sxpath "//tr[@class=\"athing\"]")))
(take (s x) 20)))
+(define (athing:id a)
+ (let ((id (sxml:attr a 'id)))
+ (if (empty? id) (error "athing:id: Unable to get id")
+ id)))
+