html.parser.analyzer: find-classes-named word.
parent
358eb29357
commit
a96ad1b227
|
@ -1,8 +1,9 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators combinators.short-circuit
|
USING: accessors assocs assocs.extras combinators
|
||||||
fry html.parser http.client io kernel locals math math.statistics
|
combinators.short-circuit fry html.parser http.client io kernel
|
||||||
sequences sets splitting unicode urls urls.encoding shuffle ;
|
locals math math.statistics sequences sets shuffle splitting
|
||||||
|
unicode urls urls.encoding ;
|
||||||
IN: html.parser.analyzer
|
IN: html.parser.analyzer
|
||||||
|
|
||||||
: scrape-html ( url -- response vector )
|
: scrape-html ( url -- response vector )
|
||||||
|
@ -204,3 +205,13 @@ TUPLE: link attributes clickable ;
|
||||||
: link. ( vector -- )
|
: link. ( vector -- )
|
||||||
[ "href" attribute write nl ]
|
[ "href" attribute write nl ]
|
||||||
[ clickable>> [ bl bl text>> print ] each nl ] bi ;
|
[ clickable>> [ bl bl text>> print ] each nl ] bi ;
|
||||||
|
|
||||||
|
: find-classes-named ( seq name -- seq' )
|
||||||
|
dupd
|
||||||
|
'[ attributes>> "class" of _ = ] find-all
|
||||||
|
[ find-between ] kv-with { } assoc>map ;
|
||||||
|
|
||||||
|
: find-classes-named* ( seq name -- seq' )
|
||||||
|
dupd
|
||||||
|
'[ attributes>> "class" of _ = ] find-all
|
||||||
|
[ find-between* ] kv-with { } assoc>map ;
|
||||||
|
|
Loading…
Reference in New Issue