[bridges] Gelbooru based imageboards derive form DanbooruBridge
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
97926b839e
commit
8ae05a0241
7 changed files with 54 additions and 230 deletions
|
@ -1,48 +1,36 @@
|
|||
<?php
|
||||
class BooruprojectBridge extends BridgeAbstract{
|
||||
require_once('GelbooruBridge.php');
|
||||
|
||||
class BooruprojectBridge extends GelbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Booruproject";
|
||||
const URI = "http://booru.org/";
|
||||
const DESCRIPTION = "Returns images from given page and booruproject instance (****.booru.org)";
|
||||
const DESCRIPTION = "Returns images from given page of booruproject";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'i'=>array(
|
||||
'name'=>'instance (required)',
|
||||
'required'=>true
|
||||
),
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
const PARAMETERS = array(
|
||||
'global'=>array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
),
|
||||
'Booru subdomain (subdomain.booru.org)'=>array(
|
||||
'i'=>array(
|
||||
'name'=>'Subdomain',
|
||||
'required'=>true
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
function getURI(){
|
||||
return 'http://'.$this->getInput('i').'.booru.org/';
|
||||
const PIDBYPAGE=20;
|
||||
|
||||
public function getURI(){
|
||||
return 'http://'.$this->getInput('i').'.booru.org/';
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
$this->getURI().'index.php?page=post&s=list'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*20:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Booruprojec.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI().$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('title');
|
||||
$item['title'] = 'Booruproject '.$this->getInput('i').' | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
public function getName(){
|
||||
return static::NAME . ' ' . $this->getInput('i');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,21 @@
|
|||
<?php
|
||||
class GelbooruBridge extends BridgeAbstract{
|
||||
require_once('DanbooruBridge.php');
|
||||
|
||||
class GelbooruBridge extends DanbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Gelbooru";
|
||||
const URI = "http://gelbooru.com/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
const PATHTODATA='.thumb';
|
||||
const IDATTRIBUTE='id';
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'index.php?page=post&s=list&'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*63:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Gelbooru.');
|
||||
const PIDBYPAGE=63;
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Gelbooru | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
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'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,12 @@
|
|||
<?php
|
||||
class MspabooruBridge extends BridgeAbstract{
|
||||
require_once('GelbooruBridge.php');
|
||||
|
||||
class MspabooruBridge extends GelbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Mspabooru";
|
||||
const URI = "http://mspabooru.com/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'index.php?page=post&s=list&'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Mspabooru.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Mspabooru | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
const PIDBYPAGE=50;
|
||||
}
|
||||
|
|
|
@ -1,41 +1,12 @@
|
|||
<?php
|
||||
class Rule34Bridge extends BridgeAbstract{
|
||||
require_once('GelbooruBridge.php');
|
||||
|
||||
class Rule34Bridge extends GelbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Rule34";
|
||||
const URI = "http://rule34.xxx/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'index.php?page=post&s=list&'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Rule34.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Rule34 | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
const PIDBYPAGE=50;
|
||||
}
|
||||
|
|
|
@ -1,40 +1,12 @@
|
|||
<?php
|
||||
class SafebooruBridge extends BridgeAbstract{
|
||||
require_once('GelbooruBridge.php');
|
||||
|
||||
class SafebooruBridge extends GelbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Safebooru";
|
||||
const URI = "http://safebooru.org/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'index.php?page=post&s=list&'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*40:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Safebooru.');
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Safebooru | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
const PIDBYPAGE=40;
|
||||
}
|
||||
|
|
|
@ -1,41 +1,12 @@
|
|||
<?php
|
||||
class TbibBridge extends BridgeAbstract{
|
||||
require_once('GelbooruBridge.php');
|
||||
|
||||
class TbibBridge extends GelbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Tbib";
|
||||
const URI = "http://tbib.org/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'index.php?page=post&s=list&'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Tbib.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Tbib | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
const PIDBYPAGE=50;
|
||||
}
|
||||
|
|
|
@ -1,41 +1,12 @@
|
|||
<?php
|
||||
class XbooruBridge extends BridgeAbstract{
|
||||
require_once('GelbooruBridge.php');
|
||||
|
||||
class XbooruBridge extends GelbooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Xbooru";
|
||||
const URI = "http://xbooru.com/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'index.php?page=post&s=list&'
|
||||
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Xbooru.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=content] span') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Xbooru | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
const PIDBYPAGE=50;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue