From d7ba7782f3ecc721a63a9f9f0b87932b246765b4 Mon Sep 17 00:00:00 2001 From: marius851000 Date: Mon, 26 Apr 2021 20:07:42 +0200 Subject: [PATCH] [DerpibooruBridge] Make it work again (#2079) --- bridges/DerpibooruBridge.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bridges/DerpibooruBridge.php b/bridges/DerpibooruBridge.php index 995e0cc1..0ad37dd1 100644 --- a/bridges/DerpibooruBridge.php +++ b/bridges/DerpibooruBridge.php @@ -2,7 +2,7 @@ class DerpibooruBridge extends BridgeAbstract { const NAME = 'Derpibooru Bridge'; const URI = 'https://derpibooru.org/'; - const DESCRIPTION = 'Returns newest posts from a Derpibooru search'; + const DESCRIPTION = 'Returns newest images from a Derpibooru search'; const CACHE_TIMEOUT = 300; // 5min const MAINTAINER = 'Roliga'; @@ -73,13 +73,13 @@ class DerpibooruBridge extends BridgeAbstract { public function collectData(){ $queryJson = json_decode(getContents( self::URI - . 'search.json?filter_id=' + . 'api/v1/json/search/images?filter_id=' . urlencode($this->getInput('f')) . '&q=' . urlencode($this->getInput('q')) )) or returnServerError('Failed to query Derpibooru'); - foreach($queryJson->search as $post) { + foreach($queryJson->images as $post) { $item = array(); $postUri = self::URI . $post->id; @@ -88,25 +88,27 @@ class DerpibooruBridge extends BridgeAbstract { $item['title'] = $post->id; $item['timestamp'] = strtotime($post->created_at); $item['author'] = $post->uploader; - $item['enclosures'] = array('https:' . $post->image); - $item['categories'] = explode(', ', $post->tags); + $item['enclosures'] = array($post->view_url); + $item['categories'] = $post->tags; $item['content'] = '

' // description . $post->description . '

Size: ' // image size . $post->width . 'x' - . $post->height - . '
Source: source_url . '">' . $post->source_url . '

'; - + }; $this->items[] = $item; } }