forked from blallo/rss-bridge
[new] Bridges for DTC and SDZ
This commit is contained in:
parent
b866fb74c0
commit
4f59e2441c
2 changed files with 81 additions and 0 deletions
42
bridges/DansTonChatBridge.php
Normal file
42
bridges/DansTonChatBridge.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* RssBridgeDansTonChat
|
||||||
|
* Retrieve lastest quotes from DansTonChat.
|
||||||
|
* Returns the most recent quotes, sorting by date (most recent first).
|
||||||
|
*
|
||||||
|
* @name DansTonChat Bridge
|
||||||
|
* @description Returns latest quotes from DansTonChat.
|
||||||
|
*/
|
||||||
|
class DansTonChatBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
public function collectData(array $param){
|
||||||
|
$html = '';
|
||||||
|
$link = 'http://danstonchat.com/latest.html';
|
||||||
|
|
||||||
|
$html = file_get_html($link) or $this->returnError('Could not request DansTonChat.', 404);
|
||||||
|
|
||||||
|
foreach($html->find('div.item') as $element) {
|
||||||
|
$item = new \Item();
|
||||||
|
$item->uri = $element->find('a', 0)->href;
|
||||||
|
$item->title = 'DansTonChat '.$element->find('a', 1)->plaintext;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
//$item->content = $element->find('p.item-content', 0)->innertext;
|
||||||
|
>>>>>>> d194d02... [new] Bridges for DTC and SDZ
|
||||||
|
$item->content = $element->find('a', 0)->innertext;
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(){
|
||||||
|
return 'DansTonChat';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getURI(){
|
||||||
|
return 'http://danstonchat.com';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCacheDuration(){
|
||||||
|
return 21600; // 6 hours
|
||||||
|
}
|
||||||
|
}
|
39
bridges/OpenClassroomsBridge.php
Normal file
39
bridges/OpenClassroomsBridge.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* RssBridgeOpenClassrooms
|
||||||
|
* Retrieve lastest tutorials from OpenClassrooms.
|
||||||
|
* Returns the most recent tutorials, sorting by date (most recent first).
|
||||||
|
*
|
||||||
|
* @name OpenClassrooms Bridge
|
||||||
|
* @description Returns latest tutorials from OpenClassrooms.
|
||||||
|
* @use1(u="informatique or sciences")
|
||||||
|
*/
|
||||||
|
class OpenClassroomsBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
public function collectData(array $param){
|
||||||
|
$html = '';
|
||||||
|
$link = 'http://fr.openclassrooms.com/'.$param[u].'/cours?title=&sort=updatedAt+desc';
|
||||||
|
|
||||||
|
$html = file_get_html($link) or $this->returnError('Could not request OpenClassrooms.', 404);
|
||||||
|
|
||||||
|
foreach($html->find('li.col6') as $element) {
|
||||||
|
$item = new \Item();
|
||||||
|
$item->uri = 'http://fr.openclassrooms.com'.$element->find('a', 0)->href;
|
||||||
|
$item->title = $element->find('div.courses-content strong', 0)->innertext;
|
||||||
|
$item->content = $element->find('span.course-tags', 0)->innertext;
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(){
|
||||||
|
return 'OpenClassrooms';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getURI(){
|
||||||
|
return 'http://fr.openclassrooms.com';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCacheDuration(){
|
||||||
|
return 21600; // 6 hours
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue