diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php
index 635aae55..b6df6654 100644
--- a/bridges/BooruprojectBridge.php
+++ b/bridges/BooruprojectBridge.php
@@ -1,48 +1,36 @@
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'] = '->src . ')
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
+ public function getName(){
+ return static::NAME . ' ' . $this->getInput('i');
}
}
diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php
index 3ee8cb6c..9f0a8c6a 100644
--- a/bridges/DanbooruBridge.php
+++ b/bridges/DanbooruBridge.php
@@ -1,39 +1,54 @@
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'] = '
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'] = '
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
+ }
}
diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php
index 4af5fb3d..90da94d7 100644
--- a/bridges/DollbooruBridge.php
+++ b/bridges/DollbooruBridge.php
@@ -1,41 +1,11 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}
diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php
index f612c98c..25cd6a3a 100644
--- a/bridges/GelbooruBridge.php
+++ b/bridges/GelbooruBridge.php
@@ -1,40 +1,21 @@
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'] = '
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'));
}
}
diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php
index 0a213fec..6d170312 100644
--- a/bridges/KonachanBridge.php
+++ b/bridges/KonachanBridge.php
@@ -1,46 +1,11 @@
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'] = '
Tags: '.$json['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}
diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php
index d2f90668..781bc238 100644
--- a/bridges/LolibooruBridge.php
+++ b/bridges/LolibooruBridge.php
@@ -1,46 +1,11 @@
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'] = '
Tags: '.$json['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}
diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php
index 43799df0..bc10c3f9 100644
--- a/bridges/MilbooruBridge.php
+++ b/bridges/MilbooruBridge.php
@@ -1,39 +1,11 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}
diff --git a/bridges/MoebooruBridge.php b/bridges/MoebooruBridge.php
new file mode 100644
index 00000000..af76de43
--- /dev/null
+++ b/bridges/MoebooruBridge.php
@@ -0,0 +1,49 @@
+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'] = '
Tags: '.$json['tags'];
+ $this->items[] = $item;
+ }
+ }
+
+ public function getCacheDuration(){
+ return 1800; // 30 minutes
+ }
+}
diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php
index 821207e5..96ae52ad 100644
--- a/bridges/MspabooruBridge.php
+++ b/bridges/MspabooruBridge.php
@@ -1,42 +1,12 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
+ const PIDBYPAGE=50;
}
diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php
index 541184df..62a9e105 100644
--- a/bridges/Rule34Bridge.php
+++ b/bridges/Rule34Bridge.php
@@ -1,41 +1,12 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
+ const PIDBYPAGE=50;
}
diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php
index 54259a32..abba0b6f 100644
--- a/bridges/Rule34pahealBridge.php
+++ b/bridges/Rule34pahealBridge.php
@@ -1,39 +1,10 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}
diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php
index d27702ce..ea1c0043 100644
--- a/bridges/SafebooruBridge.php
+++ b/bridges/SafebooruBridge.php
@@ -1,40 +1,12 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
+ const PIDBYPAGE=40;
}
diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php
index 86ffa5d6..11c56036 100644
--- a/bridges/SakugabooruBridge.php
+++ b/bridges/SakugabooruBridge.php
@@ -1,46 +1,11 @@
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'] = '
Tags: '.$json['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}
diff --git a/bridges/Shimmie2Bridge.php b/bridges/Shimmie2Bridge.php
new file mode 100644
index 00000000..80a242ae
--- /dev/null
+++ b/bridges/Shimmie2Bridge.php
@@ -0,0 +1,31 @@
+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'] = '
Tags: '.$item['tags'];
+ return $item;
+ }
+
+}
diff --git a/bridges/TbibBridge.php b/bridges/TbibBridge.php
index 1927a67c..d9c2119c 100644
--- a/bridges/TbibBridge.php
+++ b/bridges/TbibBridge.php
@@ -1,41 +1,12 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
+ const PIDBYPAGE=50;
}
diff --git a/bridges/XbooruBridge.php b/bridges/XbooruBridge.php
index a909b068..e0bd4e18 100644
--- a/bridges/XbooruBridge.php
+++ b/bridges/XbooruBridge.php
@@ -1,41 +1,12 @@
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'] = '
Tags: '.$item['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
+ const PIDBYPAGE=50;
}
diff --git a/bridges/YandereBridge.php b/bridges/YandereBridge.php
index 44a6ca12..61b59620 100644
--- a/bridges/YandereBridge.php
+++ b/bridges/YandereBridge.php
@@ -1,46 +1,11 @@
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'] = '
Tags: '.$json['tags'];
- $this->items[] = $item;
- }
- }
-
- public function getCacheDuration(){
- return 1800; // 30 minutes
- }
}