Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to go about reading a web page lazily in Clojure

I and a friend recently implemented link grabbing in my Clojure IRC bot. When it sees a link, it slurps the page and grabs the title from the page. The problem is that it has to slurp the ENTIRE page just to grab the link.

How does one go about reading a page lazily until the first </title>?

like image 385
Rayne Avatar asked Dec 17 '22 01:12

Rayne


1 Answers

Use line-seq but don't forget to close the underlying stream when done.

like image 155
cgrand Avatar answered Feb 23 '23 08:02

cgrand