Merge branch 'ooruFusion' of https://framagit.org/peetah/rss-bridge
This commit is contained in:
commit
cd361f8fc0
17 changed files with 200 additions and 508 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,39 +1,54 @@
|
|||
<?php
|
||||
class DanbooruBridge extends BridgeAbstract{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Danbooru";
|
||||
const URI = "http://donmai.us/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Danbooru";
|
||||
const URI = "http://donmai.us/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
const PARAMETERS = array(
|
||||
'global'=>array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'defaultValue'=>1,
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
),
|
||||
0=>array()
|
||||
);
|
||||
|
||||
public function collectData(){
|
||||
$page = $this->getInput('p')?$this->getInput('p'):1;
|
||||
$tags = urlencode($this->getInput('t'));
|
||||
const PATHTODATA='article';
|
||||
const IDATTRIBUTE='data-id';
|
||||
|
||||
$html = $this->getSimpleHTMLDOM(self::URI."posts?&page=$page&tags=$tags")
|
||||
or $this->returnServerError('Could not request Danbooru.');
|
||||
foreach($html->find('div[id=posts] article') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = self::URI.$element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = 'Danbooru | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
protected function getFullURI(){
|
||||
return $this->getURI().'posts?'
|
||||
.'&page='.$this->getInput('p')
|
||||
.'&tags='.urlencode($this->getInput('t'));
|
||||
}
|
||||
|
||||
protected function getItemFromElement($element){
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI().$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute(static::IDATTRIBUTE));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $this->getURI().$element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
|
||||
$item['title'] = $this->getName().' | '.$item['postid'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM($this->getFullURI())
|
||||
or $this->returnServerError('Could not request '.$this->getName());
|
||||
|
||||
foreach($html->find(static::PATHTODATA) as $element) {
|
||||
$this->items[] = $this->getItemFromElement($element);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,11 @@
|
|||
<?php
|
||||
class DollbooruBridge extends BridgeAbstract{
|
||||
require_once('Shimmie2Bridge.php');
|
||||
|
||||
class DollbooruBridge extends Shimmie2Bridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Dollbooru";
|
||||
const URI = "http://dollbooru.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(){
|
||||
$page=$this->getInput('p');
|
||||
$tags = urlencode($this->getInput('t'));
|
||||
$html = $this->getSimpleHTMLDOM(self::URI."post/list/$tags/$page")
|
||||
or $this->returnServerError('Could not request Dollbooru.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=shm-image-list] a') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = self::URI.$element->find('img', 0)->src;
|
||||
$item['tags'] = $element->getAttribute('data-tags');
|
||||
$item['title'] = 'Dollbooru | '.$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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,46 +1,11 @@
|
|||
<?php
|
||||
class KonachanBridge extends BridgeAbstract{
|
||||
require_once('MoebooruBridge.php');
|
||||
|
||||
class KonachanBridge extends MoebooruBridge {
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Konachan";
|
||||
const URI = "http://konachan.com/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'defaultValue'=>1,
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'/post?'
|
||||
.'&page='.$this->getInput('p')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Konachan.');
|
||||
|
||||
$input_json = explode('Post.register(', $html);
|
||||
foreach($input_json as $element)
|
||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||
unset($data[0]);
|
||||
|
||||
foreach($data as $datai) {
|
||||
$json = json_decode($datai, TRUE);
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.'/post/show/'.$json['id'];
|
||||
$item['postid'] = $json['id'];
|
||||
$item['timestamp'] = $json['created_at'];
|
||||
$item['imageUri'] = $json['file_url'];
|
||||
$item['title'] = 'Konachan | '.$json['id'];
|
||||
$item['content'] = '<a href="' . $item['imageUri'] . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,46 +1,11 @@
|
|||
<?php
|
||||
class LolibooruBridge extends BridgeAbstract{
|
||||
require_once('MoebooruBridge.php');
|
||||
|
||||
class LolibooruBridge extends MoebooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Lolibooru";
|
||||
const URI = "http://lolibooru.moe/";
|
||||
const URI = "https://lolibooru.moe/";
|
||||
const DESCRIPTION = "Returns images from given page and tags";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'defaultValue'=>1,
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'post?'
|
||||
.'&page='.$this->getInput('p')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Lolibooru.');
|
||||
|
||||
$input_json = explode('Post.register(', $html);
|
||||
foreach($input_json as $element)
|
||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||
unset($data[0]);
|
||||
|
||||
foreach($data as $datai) {
|
||||
$json = json_decode($datai, TRUE);
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.'post/show/'.$json['id'];
|
||||
$item['postid'] = $json['id'];
|
||||
$item['timestamp'] = $json['created_at'];
|
||||
$item['imageUri'] = $json['file_url'];
|
||||
$item['title'] = 'Lolibooru | '.$json['id'];
|
||||
$item['content'] = '<a href="' . $item['imageUri'] . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,11 @@
|
|||
<?php
|
||||
class MilbooruBridge extends BridgeAbstract{
|
||||
require_once('Shimmie2Bridge.php');
|
||||
|
||||
class MilbooruBridge extends Shimmie2Bridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Milbooru";
|
||||
const URI = "http://sheslostcontrol.net/moe/shimmie/";
|
||||
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.'?q=/post/list/'.urlencode($this->getInput('t')).'/'.$this->getInput('p')
|
||||
)or $this->returnServerError('Could not request Milbooru.');
|
||||
|
||||
foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = self::URI.$element->find('img', 0)->src;
|
||||
$item['tags'] = $element->find('a', 0)->getAttribute('data-tags');
|
||||
$item['title'] = 'Milbooru | '.$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
|
||||
}
|
||||
}
|
||||
|
|
49
bridges/MoebooruBridge.php
Normal file
49
bridges/MoebooruBridge.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
class MoebooruBridge extends BridgeAbstract{
|
||||
|
||||
const NAME = "Moebooru";
|
||||
const URI = "https://moe.dev.myconan.net/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'defaultValue'=>1,
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
protected function getFullURI(){
|
||||
return $this->getURI().'post?'
|
||||
.'page='.$this->getInput('p')
|
||||
.'&tags='.urlencode($this->getInput('t'));
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM($this->getFullURI())
|
||||
or $this->returnServerError('Could not request '.$this->getName());
|
||||
|
||||
|
||||
$input_json = explode('Post.register(', $html);
|
||||
foreach($input_json as $element)
|
||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||
unset($data[0]);
|
||||
|
||||
foreach($data as $datai) {
|
||||
$json = json_decode($datai, TRUE);
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI().'/post/show/'.$json['id'];
|
||||
$item['postid'] = $json['id'];
|
||||
$item['timestamp'] = $json['created_at'];
|
||||
$item['imageUri'] = $json['file_url'];
|
||||
$item['title'] = $this->getName().' | '.$json['id'];
|
||||
$item['content'] = '<a href="' . $item['imageUri'] . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
}
|
|
@ -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,39 +1,10 @@
|
|||
<?php
|
||||
class Rule34pahealBridge extends BridgeAbstract{
|
||||
require_once('Shimmie2Bridge.php');
|
||||
|
||||
class Rule34pahealBridge extends Shimmie2Bridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Rule34paheal";
|
||||
const URI = "http://rule34.paheal.net/";
|
||||
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.'post/list/'.$tags.'/'.$page)
|
||||
or $this->returnServerError('Could not request Rule34paheal.');
|
||||
|
||||
|
||||
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.$element->find('a', 0)->href;
|
||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $element->find('img', 0)->src;
|
||||
$item['tags'] = $element->getAttribute('data-tags');
|
||||
$item['title'] = 'Rule34paheal | '.$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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,46 +1,11 @@
|
|||
<?php
|
||||
class SakugabooruBridge extends BridgeAbstract{
|
||||
require_once('MoebooruBridge.php');
|
||||
|
||||
class SakugabooruBridge extends MoebooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Sakugabooru";
|
||||
const URI = "http://sakuga.yshi.org/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'defaultValue'=>1,
|
||||
'type'=>'number'
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'post?'
|
||||
.'&page='.$this->getInput('p')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Sakugabooru.');
|
||||
|
||||
$input_json = explode('Post.register(', $html);
|
||||
foreach($input_json as $element)
|
||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||
unset($data[0]);
|
||||
|
||||
foreach($data as $datai) {
|
||||
$json = json_decode($datai, TRUE);
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.'/post/show/'.$json['id'];
|
||||
$item['postid'] = $json['id'];
|
||||
$item['timestamp'] = $json['created_at'];
|
||||
$item['imageUri'] = $json['file_url'];
|
||||
$item['title'] = 'Sakugabooru | '.$json['id'];
|
||||
$item['content'] = '<a href="' . $item['imageUri'] . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
}
|
||||
|
|
31
bridges/Shimmie2Bridge.php
Normal file
31
bridges/Shimmie2Bridge.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
require_once('DanbooruBridge.php');
|
||||
|
||||
class Shimmie2Bridge extends DanbooruBridge{
|
||||
|
||||
const NAME = "Shimmie v2";
|
||||
const URI = "http://shimmie.shishnet.org/v2/";
|
||||
const DESCRIPTION = "Returns images from given page";
|
||||
|
||||
const PATHTODATA='.shm-thumb-link';
|
||||
const IDATTRIBUTE='data-post-id';
|
||||
|
||||
protected function getFullURI(){
|
||||
return $this->getURI().'post/list/'
|
||||
.$this->getInput('t').'/'
|
||||
.$this->getInput('p');
|
||||
}
|
||||
|
||||
protected function getItemFromElement($element){
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI().$element->href;
|
||||
$item['id'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute(static::IDATTRIBUTE));
|
||||
$item['timestamp'] = time();
|
||||
$thumbnailUri = $this->getURI().$element->find('img', 0)->src;
|
||||
$item['tags'] = $element->getAttribute('data-tags');
|
||||
$item['title'] = $this->getName().' | '.$item['id'];
|
||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
|
||||
return $item;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,46 +1,11 @@
|
|||
<?php
|
||||
class YandereBridge extends BridgeAbstract{
|
||||
require_once('MoebooruBridge.php');
|
||||
|
||||
class YandereBridge extends MoebooruBridge{
|
||||
|
||||
const MAINTAINER = "mitsukarenai";
|
||||
const NAME = "Yande.re";
|
||||
const URI = "https://yande.re/";
|
||||
const DESCRIPTION = "Returns images from given page and tags";
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'p'=>array(
|
||||
'name'=>'page',
|
||||
'type'=>'number',
|
||||
'defaultValue'=>1
|
||||
),
|
||||
't'=>array('name'=>'tags')
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
self::URI.'post?'
|
||||
.'&page='.$this->getInput('p')
|
||||
.'&tags='.urlencode($this->getInput('t'))
|
||||
) or $this->returnServerError('Could not request Yander.');
|
||||
|
||||
$input_json = explode('Post.register(', $html);
|
||||
foreach($input_json as $element)
|
||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||
unset($data[0]);
|
||||
|
||||
foreach($data as $datai) {
|
||||
$json = json_decode($datai, TRUE);
|
||||
$item = array();
|
||||
$item['uri'] = self::URI.'post/show/'.$json['id'];
|
||||
$item['postid'] = $json['id'];
|
||||
$item['timestamp'] = $json['created_at'];
|
||||
$item['imageUri'] = $json['file_url'];
|
||||
$item['title'] = 'Yandere | '.$json['id'];
|
||||
$item['content'] = '<a href="' . $item['imageUri'] . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 1800; // 30 minutes
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue