mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[DerpibooruBridge] Make it work again (#2079)
This commit is contained in:
parent
b24b5ed3ee
commit
d7ba7782f3
@ -2,7 +2,7 @@
|
|||||||
class DerpibooruBridge extends BridgeAbstract {
|
class DerpibooruBridge extends BridgeAbstract {
|
||||||
const NAME = 'Derpibooru Bridge';
|
const NAME = 'Derpibooru Bridge';
|
||||||
const URI = 'https://derpibooru.org/';
|
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 CACHE_TIMEOUT = 300; // 5min
|
||||||
const MAINTAINER = 'Roliga';
|
const MAINTAINER = 'Roliga';
|
||||||
|
|
||||||
@ -73,13 +73,13 @@ class DerpibooruBridge extends BridgeAbstract {
|
|||||||
public function collectData(){
|
public function collectData(){
|
||||||
$queryJson = json_decode(getContents(
|
$queryJson = json_decode(getContents(
|
||||||
self::URI
|
self::URI
|
||||||
. 'search.json?filter_id='
|
. 'api/v1/json/search/images?filter_id='
|
||||||
. urlencode($this->getInput('f'))
|
. urlencode($this->getInput('f'))
|
||||||
. '&q='
|
. '&q='
|
||||||
. urlencode($this->getInput('q'))
|
. urlencode($this->getInput('q'))
|
||||||
)) or returnServerError('Failed to query Derpibooru');
|
)) or returnServerError('Failed to query Derpibooru');
|
||||||
|
|
||||||
foreach($queryJson->search as $post) {
|
foreach($queryJson->images as $post) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$postUri = self::URI . $post->id;
|
$postUri = self::URI . $post->id;
|
||||||
@ -88,25 +88,27 @@ class DerpibooruBridge extends BridgeAbstract {
|
|||||||
$item['title'] = $post->id;
|
$item['title'] = $post->id;
|
||||||
$item['timestamp'] = strtotime($post->created_at);
|
$item['timestamp'] = strtotime($post->created_at);
|
||||||
$item['author'] = $post->uploader;
|
$item['author'] = $post->uploader;
|
||||||
$item['enclosures'] = array('https:' . $post->image);
|
$item['enclosures'] = array($post->view_url);
|
||||||
$item['categories'] = explode(', ', $post->tags);
|
$item['categories'] = $post->tags;
|
||||||
|
|
||||||
$item['content'] = '<p><a href="' // image preview
|
$item['content'] = '<p><a href="' // image preview
|
||||||
. $postUri
|
. $postUri
|
||||||
. '"><img src="https:'
|
. '"><img src="'
|
||||||
. $post->representations->medium
|
. $post->representations->medium
|
||||||
. '"></a></p><p>' // description
|
. '"></a></p><p>' // description
|
||||||
. $post->description
|
. $post->description
|
||||||
. '</p><p><b>Size:</b> ' // image size
|
. '</p><p><b>Size:</b> ' // image size
|
||||||
. $post->width
|
. $post->width
|
||||||
. 'x'
|
. 'x'
|
||||||
. $post->height
|
. $post->height;
|
||||||
. '<br><b>Source:</b> <a href="' // source link
|
// source link
|
||||||
|
if ($post->source_url != null) {
|
||||||
|
$item['content'] .= '<br><b>Source:</b> <a href="'
|
||||||
. $post->source_url
|
. $post->source_url
|
||||||
. '">'
|
. '">'
|
||||||
. $post->source_url
|
. $post->source_url
|
||||||
. '</a></p>';
|
. '</a></p>';
|
||||||
|
};
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user