Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.25 KB

README.md

File metadata and controls

46 lines (35 loc) · 1.25 KB

description

net is a simple and handy wrapper of common lisp package dramka.

usage

use quicklisp to load this package.

(ql:quickload :net)
;; get raw content
(defvar raw-content (net:wget "http://some.url.com/"))
;; use [Closure HTML](http://common-lisp.net/project/closure/closure-html/) to parse
(defvar list-content (net:parse raw-content))
;; select your content.
(defvar useful (net:find-node list-content
                              #'(lambda (x) (and (listp x)
                                           (eq :div (first x))))
                              #'third))
;; now useful is the collection of content of outermost <div>.

example

First it is super simple that I suggest you read the source code.

Crawl Example

cookies or post

gbk encoding:
(babel:octets-to-string (net:wget url) :encoding :gbk)

recommand packages

;; very good json library
;; (ql:quickload :st-json)
;; GBK codec facility
;; (ql:quickload :babel)
;; regular expression library
;; (ql:quickload :cl-ppcre)

license

BSD 2-Clause License.