Advertisement
Guest User

Untitled

a guest
Apr 19th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.62 KB | None | 0 0
  1. (ql:quickload :drakma)
  2. (ql:quickload :yason)
  3. (ql:quickload :quri)
  4.  
  5. (defun google-search-uri (querystring)
  6.   (quri:render-uri (quri:make-uri :scheme "https"
  7.                                   :host "suggestqueries.google.com"
  8.                                   :path "/complete/search"
  9.                                   :query `(("output" . "firefox")
  10.                                            ("q" . ,querystring)))))
  11.  
  12. (defun google-search-suggestion (querystring)
  13.   (nth 1 (let ((stream (drakma:http-request (google-search-uri querystring)
  14.                                             :want-stream t)))
  15.            (setf (flexi-streams:flexi-stream-external-format stream) :utf-8)
  16.            (yason:parse stream :object-as :plist))))
  17.  
  18. (google-search-suggestion "lisp")
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement