1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-12 03:24:01 +02:00

[GelbooruBridge] + inheriting Bridges. Switch to using Gelbooru API (#2472)

This commit is contained in:
quickwick
2022-03-29 13:42:09 -07:00
committed by GitHub
parent c6675ddeee
commit 907d09f116
7 changed files with 114 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
<?php
require_once('GelbooruBridge.php');
require_once('DanbooruBridge.php');
class BooruprojectBridge extends GelbooruBridge {
class BooruprojectBridge extends DanbooruBridge {
const MAINTAINER = 'mitsukarenai';
const NAME = 'Booruproject';
@@ -11,6 +11,7 @@ class BooruprojectBridge extends GelbooruBridge {
'global' => array(
'p' => array(
'name' => 'page',
'defaultValue' => 0,
'type' => 'number'
),
't' => array(
@@ -29,8 +30,30 @@ class BooruprojectBridge extends GelbooruBridge {
)
);
const PATHTODATA = '.thumb';
const IDATTRIBUTE = 'id';
const TAGATTRIBUTE = 'title';
const PIDBYPAGE = 20;
protected function getFullURI(){
return $this->getURI()
. 'index.php?page=post&s=list&pid='
. ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
. '&tags=' . urlencode($this->getInput('t'));
}
protected function getTags($element){
$tags = parent::getTags($element);
$tags = explode(' ', $tags);
// Remove statistics from the tags list (identified by colon)
foreach($tags as $key => $tag) {
if(strpos($tag, ':') !== false) unset($tags[$key]);
}
return implode(' ', $tags);
}
public function getURI(){
if(!is_null($this->getInput('i'))) {
return 'https://' . $this->getInput('i') . '.booru.org/';