Oladon

new-page-iterate 2

Nov 9th, 2013
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defun new-page-iterate (iterfunc url)
  2.   (let* ((threadbase (ppcre:regex-replace "\\?[^&]+"
  3.                                           (ppcre:regex-replace "&page=(last|first|[0-9]+)"
  4.                                                                url
  5.                                                                "")
  6.                                           ""))
  7.          (page (get-parsed-page (make-new-url threadbase '(("page" . 1))))))
  8.     (reverse (loop as nextpage = (extract-next-page-number page)
  9.                    append (reverse (funcall iterfunc page))
  10.                    while nextpage
  11.                    do (setq page (get-parsed-page (make-new-url nextpage)))))))
Advertisement
Add Comment
Please, Sign In to add comment