! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs assocs.extras combinators
-combinators.short-circuit fry html.parser http.client io kernel
-locals math math.statistics sequences sets shuffle splitting
-unicode urls urls.encoding ;
+combinators.short-circuit html.parser http.client io kernel math
+math.statistics sequences sets splitting unicode urls
+urls.encoding ;
IN: html.parser.analyzer
: scrape-html ( url -- response vector )
[ { [ name>> = ] [ closing?>> not ] } 1&& ] with find-all ;
: href-contains? ( str tag -- ? )
- "href" attribute* [ subseq? ] [ 2drop f ] if ;
+ "href" attribute* [ swap subseq-of? ] [ 2drop f ] if ;
: find-hrefs ( vector -- vector' )
[ { [ name>> "a" = ] [ "href" attribute? ] } 1&& ] filter sift