wisp

get interweb fluff
Log | Files | Refs

commit 68ec686a93b5e461a1bcf14b00c6ecdda4af87d1
parent c4804380117468bc41e88855a77b9974c039a929
Author: rsiddharth <s@ricketyspace.net>
Date:   Thu,  6 Jun 2019 19:41:01 -0400

hn/g: Add athings.

* hn/g (athings): New function.

Diffstat:
hn/g | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/hn/g b/hn/g @@ -7,11 +7,13 @@ #lang racket/base +(require racket/list) (require racket/port) (require net/http-client) (require openssl) +(require html-parsing) (require sxml/sxpath) @@ -25,3 +27,10 @@ (define-values (status headers port) (http-conn-sendrecv! hc "/")) (port->string port))) + +(define (athings) + "Get 20 athings from HN front page." + (let ((x (html->xexp (fp))) + (s (sxpath "//tr[@class=\"athing\"]"))) + (take (s x) 20))) +