summaryrefslogtreecommitdiff
path: root/bridges/Rule34pahealBridge.php
blob: 0e13ed033d56cd947e3a315b7f5e2ad9bf20648a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once('Shimmie2Bridge.php');

class Rule34pahealBridge extends Shimmie2Bridge {

	const MAINTAINER = 'mitsukarenai';
	const NAME = 'Rule34paheal';
	const URI = 'https://rule34.paheal.net/';
	const DESCRIPTION = 'Returns images from given page';

	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 = $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;
	}
}