aboutsummaryrefslogtreecommitdiff
path: root/bridges/Shimmie2Bridge.php
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/Shimmie2Bridge.php')
-rw-r--r--bridges/Shimmie2Bridge.php62
1 files changed, 32 insertions, 30 deletions
diff --git a/bridges/Shimmie2Bridge.php b/bridges/Shimmie2Bridge.php
index a279c77d..0a87d65e 100644
--- a/bridges/Shimmie2Bridge.php
+++ b/bridges/Shimmie2Bridge.php
@@ -1,37 +1,39 @@
<?php
-class Shimmie2Bridge extends DanbooruBridge {
+class Shimmie2Bridge extends DanbooruBridge
+{
+ const NAME = 'Shimmie v2';
+ const URI = 'https://shimmie.shishnet.org/';
+ const DESCRIPTION = 'Returns images from given page';
- const NAME = 'Shimmie v2';
- const URI = 'https://shimmie.shishnet.org/';
- const DESCRIPTION = 'Returns images from given page';
+ const PATHTODATA = '.shm-thumb-link';
+ const IDATTRIBUTE = 'data-post-id';
- 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 getFullURI(){
- return $this->getURI()
- . 'post/list/'
- . $this->getInput('t')
- . '/'
- . $this->getInput('p');
- }
+ protected function getItemFromElement($element)
+ {
+ $item = [];
+ $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['categories'] = explode(' ', $element->getAttribute('data-tags'));
+ $item['title'] = $this->getName() . ' | ' . $item['id'];
+ $item['content'] = '<a href="'
+ . $item['uri']
+ . '"><img src="'
+ . $thumbnailUri
+ . '" /></a><br>Tags: '
+ . $element->getAttribute('data-tags');
- 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['categories'] = explode(' ', $element->getAttribute('data-tags'));
- $item['title'] = $this->getName() . ' | ' . $item['id'];
- $item['content'] = '<a href="'
- . $item['uri']
- . '"><img src="'
- . $thumbnailUri
- . '" /></a><br>Tags: '
- . $element->getAttribute('data-tags');
-
- return $item;
- }
+ return $item;
+ }
}