[Rule34pahealBridge] code simplification
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
5704b6e3c4
commit
10d5bb630f
1 changed files with 3 additions and 9 deletions
|
@ -16,19 +16,13 @@ class Rule34pahealBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 0;$tags='';
|
$html = $this->getSimpleHTMLDOM($this->uri.'post/list/'.$tags.'/'.$page)
|
||||||
if ($this->getInput('p')) {
|
or $this->returnServerError('Could not request Rule34paheal.');
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
|
||||||
}
|
|
||||||
if ($this->getInput('t')) {
|
|
||||||
$tags = urlencode($this->getInput('t'));
|
|
||||||
}
|
|
||||||
$html = $this->getSimpleHTMLDOM("http://rule34.paheal.net/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) {
|
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = 'http://rule34.paheal.net'.$element->find('a', 0)->href;
|
$item['uri'] = $this->uri.$element->find('a', 0)->href;
|
||||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
|
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
|
|
Loading…
Reference in a new issue