google.search: Add fileFormat slot. Rename http-search to google-search
parent
51b01d73b3
commit
56ee372f15
|
@ -23,11 +23,11 @@ IN: google.search
|
||||||
new [ set-slots ] keep ;
|
new [ set-slots ] keep ;
|
||||||
|
|
||||||
TUPLE: search-result cacheUrl GsearchResultClass visibleUrl
|
TUPLE: search-result cacheUrl GsearchResultClass visibleUrl
|
||||||
title content unescapedUrl url titleNoFormatting ;
|
title content unescapedUrl url titleNoFormatting fileFormat ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: http-search ( query -- results )
|
: google-search ( query -- results )
|
||||||
search-url http-get nip json>
|
search-url http-get nip json>
|
||||||
{ "responseData" "results" } deep-at
|
{ "responseData" "results" } deep-at
|
||||||
[ \ search-result from-slots ] map ;
|
[ \ search-result from-slots ] map ;
|
||||||
|
@ -56,9 +56,9 @@ PRIVATE>
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: http-search. ( query -- )
|
: google-search. ( query -- )
|
||||||
[ "Search results for '%s'" sprintf write-heading nl ]
|
[ "Search results for '%s'" sprintf write-heading nl ]
|
||||||
[ http-search ] bi [
|
[ google-search ] bi [
|
||||||
{
|
{
|
||||||
[ titleNoFormatting>> write-title ]
|
[ titleNoFormatting>> write-title ]
|
||||||
[ content>> write-content ]
|
[ content>> write-content ]
|
||||||
|
|
Loading…
Reference in New Issue