Created
February 22, 2014 02:26
-
-
Save arademaker/9147706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload :drakma) | |
(ql:quickload :st-json) | |
(defun show-google-hits (term key ck) | |
(let* ((query (list (cons "key" key) | |
(cons "cx" ck) | |
(cons "q" term))) | |
(stream (drakma:http-request "https://www.googleapis.com/customsearch/v1" | |
:parameters query | |
:want-stream t))) | |
(setf (flexi-streams:flexi-stream-external-format stream) :utf-8) | |
(let* ((doc (yason:parse stream :object-as :alist)) | |
(res (cadr (assoc "items" doc :test #'equal)))) | |
(list (cdr (assoc "link" res :test #'equal)) | |
(cdr (assoc "title" res :test #'equal)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment