6 (require "blacklist.rkt")
8 (define (member-match? itm lst)
10 (regexp-match? (regexp i) itm))
13 (define (get-results query)
14 (define engine (string->url
15 "https://search.trom.tf/search?q=facebook&format=json"))
16 (define response (get-pure-port engine))
17 (define json-raw (port->string response))
18 (close-input-port response)
21 (with-input-from-string
26 ; Parse and filter results
27 ; TODO: replace this with tail-call recursion and return instead of printing
29 (define result-title (hash-ref i 'title ""))
30 (define result-url (url-host (string->url (hash-ref i 'url ""))))
31 (define result-content (hash-ref i 'content ""))
33 (unless (member-match? result-url blacklist)
34 (writeln result-title)
36 (writeln result-content)
40 (hash-ref json 'results))