forked from blallo/rss-bridge
Update DilbertBridge
This commit is contained in:
parent
cd1740bd56
commit
05216d9c39
1 changed files with 9 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @name Dilbert Daily Strip
|
||||
* @name Dilbert Daily Strip
|
||||
* @homepage http://dilbert.com/strips/
|
||||
* @description The Unofficial Dilbert Daily Comic Strip
|
||||
* @update 16/10/2013
|
||||
|
@ -11,17 +11,15 @@ class DilbertBridge extends BridgeAbstract{
|
|||
|
||||
public function collectData(array $param){
|
||||
$html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404);
|
||||
|
||||
foreach($html->find('div.STR_Image') as $element) {
|
||||
|
||||
foreach($html->find('section.comic-item') as $element) {
|
||||
$comic = $element->find('img', 0);
|
||||
|
||||
$item = new Item();
|
||||
$href = $element->find('a',0)->href;
|
||||
$item->uri = 'http://dilbert.com' . $href;
|
||||
$content = str_replace('src="/', 'src="http://dilbert.com/',$element->innertext);
|
||||
$content = str_replace('href="/', 'href="http://dilbert.com/',$content);
|
||||
$item->content = $content;
|
||||
$time = strtotime(substr($href, (strrpos($href, "/", -10) + 1), 10));
|
||||
$item->title = date("d/m/Y", $time);
|
||||
$item->timestamp = $time;
|
||||
$item->uri = $element->find('a',0)->href;
|
||||
$item->content = '<img src="'. $comic->src . '" alt="' . $comic->alt . '" />';
|
||||
$item->title = $comic->alt;
|
||||
$item->timestamp = strtotime($element->find('h3', 0)->plaintext);
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue