Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ORelio 2016-02-13 14:15:10 +01:00
commit 54812d626e
5 changed files with 207 additions and 10 deletions

View file

@ -22,15 +22,17 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$this->maintainer = "lagaisse"; $this->maintainer = "lagaisse";
$this->name = "Cpasbien Bridge"; $this->name = "Cpasbien Bridge";
$this->uri = "http://Cpasbien.pw/"; $this->uri = "http://www.cpasbien.io";
$this->description = "Returns latest torrent from request query"; $this->description = "Returns latest torrents from a request query";
$this->update = "2015-05-17"; $this->update = "2016-01-26";
$this->parameters[] = $this->parameters[] =
'[ '[
{ {
"name" : "keyword", "name" : "Search",
"identifier" : "q" "identifier" : "q",
"required" : true,
"title" : "Type your search"
} }
]'; ]';
@ -38,10 +40,11 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$this->loadMetadatas();
$html = ''; $html = '';
if (isset($param['q'])) { /* keyword search mode */ if (isset($param['q'])) { /* keyword search mode */
$this->request = str_replace(" ","-",trim($param['q'])); $this->request = str_replace(" ","-",trim($param['q']));
$html = file_get_html('http://www.cpasbien.pw/recherche/'.urlencode($this->request).'.html') or $this->returnError('No results for this query.', 404); $html = file_get_html($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnError('No results for this query.', 404);
} }
else { else {
$this->returnError('You must specify a keyword (?q=...).', 400); $this->returnError('You must specify a keyword (?q=...).', 400);
@ -66,7 +69,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
} }
$item->id = $episode->find('a', 0)->getAttribute('href'); $item->id = $episode->find('a', 0)->getAttribute('href');
$item->uri = $this->getURI() . $htmlepisode->find('#telecharger',0)->getAttribute('href'); $item->uri = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href');
$item->thumbnailUri = $htmlepisode->find('#bigcover', 0)->find('img',0)->getAttribute('src'); $item->thumbnailUri = $htmlepisode->find('#bigcover', 0)->find('img',0)->getAttribute('src');
$this->items[] = $item; $this->items[] = $item;
} }
@ -77,11 +80,11 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
public function getName(){ public function getName(){
return (!empty($this->request) ? $this->request .' - ' : '') .'Cpasbien Bridge'; return (!empty($this->request) ? $this->request .' - ' : '') . $this->name;
} }
public function getURI(){ public function getURI(){
return 'http://www.cpasbien.pw'; return $this->uri;
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -134,7 +134,7 @@ class LeBonCoinBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $html = '';
$link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r'] . '/?f=a&th=1&q=' . $param['k']; $link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']);
$html = file_get_html($link) or $this->returnError('Could not request LeBonCoin.', 404); $html = file_get_html($link) or $this->returnError('Could not request LeBonCoin.', 404);
$list = $html->find('.list-lbc', 0); $list = $html->find('.list-lbc', 0);

View file

@ -0,0 +1,52 @@
<?php
class LinkedInCompany extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "regisenguehard";
$this->name = "LinkedIn Company";
$this->uri = "https://www.linkedin.com/";
$this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)";
$this->update = "2015-12-22";
$this->parameters[] =
'[
{
"name" : "Company name",
"identifier" : "c"
}
]';
}
public function collectData(array $param){
$html = '';
$link = 'https://www.linkedin.com/company/'.$param[c];
$html = file_get_html($link) or $this->returnError('Could not request LinkedIn.', 404);
foreach($html->find('//*[@id="my-feed-post"]/li') as $element) {
$title = $element->find('span.share-body', 0)->innertext;
if ($title) {
$item = new \Item();
$item->uri = $link;
$item->title = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100);
$item->content = strip_tags($element->find('span.share-body', 0)->innertext);
$item->thumbnailUri = htmlspecialchars_decode($element->find('img', 0)->attr['data-li-lazy-load-src']);
$this->items[] = $item;
$i++;
}
}
}
public function getName(){
return 'LinkedIn';
}
public function getURI(){
return 'https://www.linkedin.com';
}
public function getCacheDuration(){
return 21600; // 6 hours
}
}

View file

@ -0,0 +1,90 @@
<?php
//Based on https://github.com/sebsauvage/rss-bridge/blob/master/bridges/TwitterBridgeClean.php by vinzv
class TwitterBridgeCleanExtended extends BridgeAbstract{
private $request;
public function loadMetadatas() {
$this->maintainer = "Max Mehl";
$this->name = "Twitter Bridge Clean Extended";
$this->uri = "http://twitter.com/";
$this->description = "Returns user timelines showing RTs correctly or search results for keywords/hashtags (without using their API).";
$this->update = "2016-01-27";
$this->parameters["By keyword or hashtag"] =
'[
{
"name" : "Keyword or #hashtag",
"identifier" : "q"
}
]';
$this->parameters["By username"] =
'[
{
"name" : "username",
"identifier" : "u"
}
]';
}
public function collectData(array $param){
$html = '';
if (isset($param['q'])) { /* keyword search mode */
$this->request = $param['q'];
$html = file_get_html('https://twitter.com/search?q='.urlencode($this->request).'&f=tweets') or $this->returnError('No results for this query.', 404);
}
elseif (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u'];
$html = file_get_html('http://twitter.com/'.urlencode($this->request)) or $this->returnError('Requested username can\'t be found.', 404);
}
else {
$this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
}
foreach($html->find('div.js-stream-tweet') as $tweet) {
$item = new \Item();
$item->username = $tweet->getAttribute('data-screen-name'); // extract username and sanitize
$item->fullname = $tweet->getAttribute('data-name'); // extract fullname (pseudonym)
$item->avatar = $tweet->find('img', 0)->src; // get avatar link
$item->id = $tweet->getAttribute('data-tweet-id'); // get TweetID
$item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href'); // get tweet link
$item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time'); // extract tweet timestamp
// processing content links
foreach($tweet->find('a') as $link) {
if($link->hasAttribute('data-expanded-url') ) {
$link->href = $link->getAttribute('data-expanded-url');
}
$link->removeAttribute('data-expanded-url');
$link->removeAttribute('data-query-source');
$link->removeAttribute('rel');
$link->removeAttribute('class');
$link->removeAttribute('target');
$link->removeAttribute('title');
$link->removeAttribute('dir');
}
$item->content = str_replace('pic.twitter.com', 'https://pic.twitter.com', strip_tags($tweet->find('p.js-tweet-text', 0)->innertext)); // extract tweet text
if(isset($param['u'])) {
if($item->username != $param['u']) {
$item->content = '&#9851; @' . $item->username . ': ' . $item->content;
}
}
$item->title = $item->content;
$this->items[] = $item;
}
}
public function getName(){
return (!empty($this->request) ? $this->request : '');
}
public function getURI(){
return 'http://twitter.com';
}
public function getCacheDuration(){
return 300; // 5 minutes
}
}

52
bridges/ViadeoCompany.php Normal file
View file

@ -0,0 +1,52 @@
<?php
class ViadeoCompany extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "regisenguehard";
$this->name = "Viadeo Company";
$this->uri = "https://www.viadeo.com/";
$this->description = "Returns most recent actus from Company on Viadeo. (http://www.viadeo.com/fr/company/<strong style=\"font-weight:bold;\">apple</strong>)";
$this->update = "2015-12-22";
$this->parameters[] =
'[
{
"name" : "Company name",
"identifier" : "c"
}
]';
}
public function collectData(array $param){
$html = '';
$link = 'http://www.viadeo.com/fr/company/'.$param[c];
$html = file_get_html($link) or $this->returnError('Could not request Viadeo.', 404);
foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
$title = $element->find('p', 0)->innertext;
if ($title) {
$item = new \Item();
$item->uri = $link;
$item->title = mb_substr($element->find('p', 0)->innertext, 0 ,100);
$item->content = $element->find('p', 0)->innertext;
$item->thumbnailUri = str_replace('//', 'http://', $element->find('img.usage-article__image_only', 0)->src);
$this->items[] = $item;
$i++;
}
}
}
public function getName(){
return 'Viadeo';
}
public function getURI(){
return 'https://www.viadeo.com';
}
public function getCacheDuration(){
return 21600; // 6 hours
}
}