Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun new-page-iterate (iterfunc url)
- (let* ((threadbase (ppcre:regex-replace "\\?[^&]+"
- (ppcre:regex-replace "&page=(last|first|[0-9]+)"
- url
- "")
- ""))
- (page (chtml:parse
- (get-page
- (concatenate 'string
- threadbase
- "&page=1"))
- (cxml-stp:make-builder))))
- (flet ((make-new-url (pagenum) (concatenate 'string
- threadbase
- (format nil "&page=~A" pagenum)))
- (get-new-page (newurl) (chtml:parse (get-page newurl) (cxml-stp:make-builder))))
- (reverse (loop as nextpage = (extract-next-page-number page)
- append (reverse (funcall iterfunc page))
- while nextpage
- do (setq page (get-new-page (make-new-url nextpage))))))))
Advertisement
Add Comment
Please, Sign In to add comment