-#lang racket
-
-(require json)
-(require net/url)
-
-(require "blacklist.rkt")
-
-(define (member-match? itm lst)
- (ormap (lambda (i)
- (regexp-match? (regexp i) itm))
- lst))
-
-(define (get-results query)
-(define engine (string->url
- "https://search.trom.tf/search?q=facebook&format=json"))
-(define response (get-pure-port engine))
-(define json-raw (port->string response))
-(close-input-port response)
-
-(define json
- (with-input-from-string
- json-raw
- (lambda ()
- (read-json))))
-
-; Parse and filter results
-; TODO: replace this with tail-call recursion and return instead of printing
-(for-each (lambda (i)
- (define result-title (hash-ref i 'title ""))
- (define result-url (url-host (string->url (hash-ref i 'url ""))))
- (define result-content (hash-ref i 'content ""))
-
- (unless (member-match? result-url blacklist)
- (writeln result-title)
- (writeln result-url)
- (writeln result-content)
- (writeln "")
-
- ))
- (hash-ref json 'results))
-)