|
|
|
@ -1,27 +1,22 @@
|
|
|
|
|
(in-package #:lolicore)
|
|
|
|
|
|
|
|
|
|
(defparameter *boorus* '())
|
|
|
|
|
|
|
|
|
|
(add-booru :name 'lolibooru
|
|
|
|
|
:url "https://lolibooru.moe/post/index.json?tags=rating:~a+-3dcg+-rape&limit=1&page=~a"
|
|
|
|
|
:rating-posts (make-ratings (74000 53000 92000)))
|
|
|
|
|
|
|
|
|
|
(add-booru :name 'gelbooru
|
|
|
|
|
:url "https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1&tags=rating:~a&limit=1&pid=~a"
|
|
|
|
|
:rating-posts (make-ratings (20000 20000 20000))
|
|
|
|
|
:rating-table ratings-full-words)
|
|
|
|
|
|
|
|
|
|
(defun loli-link (rating )
|
|
|
|
|
"Generate a valid link to a loli image from a random booru"
|
|
|
|
|
(let ((booru (cl-rng:within *boorus*)))
|
|
|
|
|
(format nil (url booru)
|
|
|
|
|
(get-rating booru rating)
|
|
|
|
|
(cl-rng:crandom :limit (get-posts booru rating) :transform 'floor))))
|
|
|
|
|
|
|
|
|
|
(defun loli-json (rating)
|
|
|
|
|
"Get a link using `loli-link', download it and return parsed JSON"
|
|
|
|
|
(car (jsown:parse (dex:get (loli-link rating)))))
|
|
|
|
|
|
|
|
|
|
(defun loli-data (json &key tags file-url
|
|
|
|
|
&aux (lst '()))
|
|
|
|
|
"Takes input `json' from `loli-json' and a set of keys to return
|
|
|
|
|
data from
|
|
|
|
|
|
|
|
|
|
Passing `:tags' will return the images tags, and so fourth."
|
|
|
|
|
(when tags
|
|
|
|
|
(push (add-data :tags "tags" json) lst))
|
|
|
|
|
(when file-url
|
|
|
|
@ -39,9 +34,3 @@
|
|
|
|
|
(declare (type string url))
|
|
|
|
|
(str "data:image/jpeg;base64," (qbase64:encode-bytes (dex:get url))))
|
|
|
|
|
|
|
|
|
|
(export '(loli-link
|
|
|
|
|
based-loli
|
|
|
|
|
loli-data
|
|
|
|
|
loli-json
|
|
|
|
|
loli-get
|
|
|
|
|
*boorus*))
|
|
|
|
|