forked from blallo/rss-bridge
[ pull request #86 ]
This commit is contained in:
parent
4f61ac06af
commit
bf2303ead8
4 changed files with 89 additions and 25 deletions
44
bridges/ABCTabsBridge.php
Normal file
44
bridges/ABCTabsBridge.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* ABCTabsBridge
|
||||
* Returns the newest tabs
|
||||
*
|
||||
* @name ABC Tabs Bridge
|
||||
* @homepage http://www.abc-tabs.com/
|
||||
* @description Returns 22 newest tabs
|
||||
* @maintainer kranack
|
||||
* @update 2014-07-23
|
||||
*
|
||||
*/
|
||||
class ABCTabsBridge extends BridgeAbstract{
|
||||
|
||||
private $request;
|
||||
|
||||
public function collectData(array $param){
|
||||
$html = '';
|
||||
$html = file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404);
|
||||
$table = $html->find('table#myTable', 0)->children(1);
|
||||
|
||||
foreach ($table->find('tr') as $tab)
|
||||
{
|
||||
$item = new \Item();
|
||||
$item->name = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
|
||||
$item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
|
||||
$item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
|
||||
$item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
|
||||
$item->uri = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
public function getName(){
|
||||
return 'ABC Tabs Bridge';
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return 'http://www.abc-tabs.com/';
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 3600; // 1 hour
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
* @description Returns most recent results from MondeDiplo.
|
||||
* @maintainer Pitchoule
|
||||
*/
|
||||
|
||||
class MondeDiploBridge extends BridgeAbstract{
|
||||
|
||||
public function collectData(array $param){
|
||||
|
@ -17,22 +18,34 @@ class MondeDiploBridge extends BridgeAbstract{
|
|||
|
||||
$html = file_get_html($link) or $this->returnError('Could not request MondeDiplo. for : ' . $link , 404);
|
||||
|
||||
foreach($html->find('div[class=grid_10 alpha omega laune]') as $element) {
|
||||
$item = new Item();
|
||||
$item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href;
|
||||
$NumArticle = explode("/", $element->find('a', 0)->href);
|
||||
$item->title = $element->find('h3', 0)->plaintext;
|
||||
$item->content = $element->find('div[class=crayon article-intro-'.$NumArticle[4].' intro]', 0)->plaintext;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
foreach($html->find('div.laune') as $element) {
|
||||
$item = new Item();
|
||||
$item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href;
|
||||
$item->title = $element->find('h3', 0)->plaintext;
|
||||
$item->content = $element->find('div.dates_auteurs', 0)->plaintext. '<br>' .strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
foreach($html->find('div.titraille') as $element) {
|
||||
$item = new Item();
|
||||
$liste = $html->find('div.listes', 0); // First list
|
||||
foreach ($liste->find('li') as $e) {
|
||||
|
||||
$item = new Item();
|
||||
$item->uri = 'http://www.monde-diplomatique.fr' . $e->find('a', 0)->href;
|
||||
$item->title = $e->find('a', 0)->plaintext;
|
||||
$item->content = $e->find('div.dates_auteurs', 0)->plaintext;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
foreach($html->find('div.liste ul li') as $element) {
|
||||
if ($element->getAttribute('class') != 'intrapub') {
|
||||
$item = new Item();
|
||||
$item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href;
|
||||
$item->title = $element->find('h3', 0)->plaintext;
|
||||
$item->content = $element->find('div.dates_auteurs', 0)->plaintext;
|
||||
$item->content = $element->find('div.dates_auteurs', 0)->plaintext . ' <br> ' . $element->find('div.intro', 0)->plaintext;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
|
@ -48,3 +61,4 @@ class MondeDiploBridge extends BridgeAbstract{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,17 +15,21 @@ class ScoopItBridge extends BridgeAbstract{
|
|||
|
||||
public function collectData(array $param){
|
||||
$html = '';
|
||||
$this->request = $param['u'];
|
||||
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
|
||||
if ($param['u'] != '') {
|
||||
$this->request = $param['u'];
|
||||
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
|
||||
|
||||
$html = file_get_html($link) or $this->returnError('Could not request ScoopIt. for : ' . $link , 404);
|
||||
$html = file_get_html($link) or $this->returnError('Could not request ScoopIt. for : ' . $link , 404);
|
||||
|
||||
foreach($html->find('div.post-view') as $element) {
|
||||
foreach($html->find('div.post-view') as $element) {
|
||||
$item = new Item();
|
||||
$item->uri = $element->find('a', 0)->href;
|
||||
$item->title = $element->find('div.tCustomization_post_title',0)->plaintext;
|
||||
$item->content = $element->find('div.tCustomization_post_description', 0)->plaintext;
|
||||
$item->title = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_title',0)->plaintext);
|
||||
$item->content = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext);
|
||||
$this->items[] = $item;
|
||||
}
|
||||
} else {
|
||||
$this->returnError('You must specify a keyword', 404);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,3 +45,4 @@ class ScoopItBridge extends BridgeAbstract{
|
|||
return 21600; // 6 hours
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @description Returns 10 newest music from user profile
|
||||
* @maintainer kranack
|
||||
* @update 2014-07-18
|
||||
* @use1(u="username")
|
||||
* @use1(u="username/id")
|
||||
*
|
||||
*/
|
||||
class WhydBridge extends BridgeAbstract{
|
||||
|
@ -63,3 +63,4 @@ class WhydBridge extends BridgeAbstract{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue