Added a bridge for fier-panda.fr
This commit is contained in:
parent
9c8f552a2a
commit
7d03d72708
1 changed files with 41 additions and 0 deletions
41
bridges/FierPandaBridge.php
Normal file
41
bridges/FierPandaBridge.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
Class FierPandaBridge extends BridgeAbstract{
|
||||
|
||||
public function loadMetadatas() {
|
||||
|
||||
$this->maintainer = "snroki";
|
||||
$this->name = "Fier Panda Bridge";
|
||||
$this->uri = "http://www.fier-panda.fr/";
|
||||
$this->description = "Returns latest articles from Fier Panda.";
|
||||
$this->update = "2015-12-11";
|
||||
|
||||
}
|
||||
|
||||
public function collectData(array $param){
|
||||
$link = 'http://www.fier-panda.fr/';
|
||||
|
||||
$html = file_get_html($link) or $this->returnError('Could not request Fier Panda.', 404);
|
||||
|
||||
foreach($html->find('div.container-content article') as $element) {
|
||||
$item = new \Item();
|
||||
$item->uri = $this->getURI().$element->find('a', 0)->href;
|
||||
$item->title = trim($element->find('h2 a', 0)->innertext);
|
||||
// Remove the link at the end of the article
|
||||
$element->find('p a', 0)->outertext = '';
|
||||
$item->content = $element->find('p', 0)->innertext;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return 'Fier Panda';
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return 'http://www.fier-panda.fr';
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 21600; // 6 hours
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue