From c204b9d914f075801394bf12c7cd5d7ff155e974 Mon Sep 17 00:00:00 2001 From: teromene Date: Sun, 1 Nov 2015 11:17:36 +0000 Subject: [PATCH 01/15] =?UTF-8?q?Premi=C3=A8re=20version=20du=20nouveau=20?= =?UTF-8?q?syst=C3=A8me=20de=20m=C3=A9ta-donn=C3=A9es.=20Voir=20exemple=20?= =?UTF-8?q?dans=20YoutubeBridge.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridges/YoutubeBridge.php | 77 ++++++++++++++++----- index.php | 138 ++++++++++++++++++++------------------ lib/Bridge.php | 18 +++++ 3 files changed, 150 insertions(+), 83 deletions(-) diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php index 0aa787b5..bcc6d2f6 100644 --- a/bridges/YoutubeBridge.php +++ b/bridges/YoutubeBridge.php @@ -2,25 +2,70 @@ /** * RssBridgeYoutube * Returns the newest videos -* -* @name Youtube Bridge -* @homepage https://www.youtube.com/ -* @description Returns the 10 newest videos by username/channel/playlist or search -* @maintainer mitsukarenai -* @update 2015-07-08 -* @use1(u="username") -* @use2(c="channel id") -* @use3(p="playlist id") -* @use4(s="search keyword",pa="page") -* -* WARNING: to parse big playlists (over ~90 videos), you need to edit simple_html_dom.php: +* WARNING: to parse big playlists (over ~90 videos), you need to edit simple_html_dom.php: * change: define('MAX_FILE_SIZE', 600000); * into: define('MAX_FILE_SIZE', 900000); (or more) */ -class YoutubeBridge extends BridgeAbstract{ - - private $request; - +class YoutubeBridge extends BridgeAbstract { + + + public function loadMetadatas() { + + $this->name = "Youtube Bridge"; + + $this->homepage = "https://youtube.com"; + $this->description = "Returns the 10 newest videos by username/channel/playlist or search"; + $this->maintainer = "mitsukarenai"; + + $this->parameters["By username"] = + '[ + { + "type" : "text", + "identifier" : "u", + "name" : "username", + "exampleValue" : "test" + } + ]'; + + $this->parameters['By channel id'] = + '[ + { + "type" : "number", + "identifier" : "c", + "name" : "channel id", + "exampleValue" : "15" + } + ]'; + + $this->parameters['By playlist Id'] = + '[ + { + "type" : "number", + "identifier" : "c", + "name" : "playlist id", + "exampleValue" : "15" + } + ]'; + + $this->parameters["Search result"] = + '[ + { + "type" : "text", + "identifier" : "s", + "name" : "search keyword", + "exampleValue" : "test" + + }, + { + "type" : "number", + "identifier" : "pa", + "name" : "page", + "exampleValue" : "1" + + } + ]'; + } + public function collectData(array $param){ function getPublishDate($id) { diff --git a/index.php b/index.php index 0ab85e06..494ebb39 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@ '.$bridgeInformations['name'].'' : $bridgeInformations['name']; - $description = isset($bridgeInformations['description']) ? $bridgeInformations['description'] : 'No description provided'; + + $bridgeElement = Bridge::create($bridgeName); + $bridgeElement->loadMetadatas(); + + $name = ''.$bridgeElement->name.''; + $description = $bridgeElement->description; + $card = << +

{$name}

{$description}

CARD; - if( isset($bridgeInformations['use']) && count($bridgeInformations['use']) > 0 ) + + // If we don't have any parameter for the bridge, we print a generic form to load it. + if(count($bridgeElement->parameters) == 0) { + + $card .= '
+ + ' . PHP_EOL; + + if ($isActive) { - $card .= '
    ' . PHP_EOL; - foreach($bridgeInformations['use'] as $anUseNum => $anUse) - { - $card .= '
  1. ' . PHP_EOL; - $card .= ' - - ' . PHP_EOL; - - foreach($anUse as $argValue) - { - $idArg = 'arg-' . $bridgeReference . '-' . $anUseNum . '-' . $argValue['query-name']; - if($argValue['type'] == null || $argValue['type'] == "text") { //If we have no type, treat it as a text field for compatibility - $card .= '' . PHP_EOL; - } else if($argValue['type'] == "list") { - $card .= '"; - } - - } - - $card .= '
    '; - - if ($isActive) - { - $card .= getHelperButtonsFormat($formats); - } - else - { - $card .= 'Inactive'; - } - - $card .= '
  2. ' . PHP_EOL; - } - $card .= '
' . PHP_EOL; + $card .= getHelperButtonsFormat($formats); } else { - $card .= '
- - ' . PHP_EOL; - - if ($isActive) - { - $card .= getHelperButtonsFormat($formats); - } - else - { - $card .= 'Inactive'; - } - $card .= '
' . PHP_EOL; + $card .= 'Inactive'; } + $card .= '' . PHP_EOL; + } - $card .= isset($bridgeInformations['maintainer']) ? ''.$bridgeInformations['maintainer'].'' : ''; + foreach($bridgeElement->parameters as $parameterName => $parameter) + { + $card .= '
    ' . PHP_EOL; + $card .= '
    '.$parameterName.'
    ' . PHP_EOL; + $card .= '
    + + ' . PHP_EOL; + + $parameter = json_decode($parameter, true); + + foreach($parameter as $inputEntry) { + + $idArg = 'arg-' . $bridgeName . '-' . $parameterName . '-' . $inputEntry['identifier']; + + $card .= '' . PHP_EOL; + + if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { + $card .= '
    ' . PHP_EOL; + } else if($inputEntry['type'] == 'number') { + $card .= '
    ' . PHP_EOL; + } + + } + if ($isActive) + { + $card .= getHelperButtonsFormat($formats); + } + else + { + $card .= 'Inactive'; + } + $card .= '
    ' . PHP_EOL; + + } + + $card .= ''.$bridgeElement->maintainer.''; $card .= '
'; return $card; } -$bridges = Bridge::searchInformation(); $formats = Format::searchInformation(); + ?> @@ -239,24 +240,27 @@ $formats = Format::searchInformation(); $activeFoundBridgeCount = 0; $showInactive = isset($_REQUEST['show_inactive']) && $_REQUEST['show_inactive'] == 1; $inactiveBridges = ''; - foreach($bridges as $bridgeReference => $bridgeInformations) + foreach($whitelist_selection as $bridgeName) { - if(BridgeWhitelist($whitelist_selection, $bridgeReference)) + if(BridgeWhitelist($whitelist_selection, $bridgeName)) { - echo displayBridgeCard($bridgeReference, $bridgeInformations, $formats); + echo displayBridgeCard($bridgeName, $formats); $activeFoundBridgeCount++; } elseif ($showInactive) { // inactive bridges - $inactiveBridges .= displayBridgeCard($bridgeReference, $bridgeInformations, $formats, false) . PHP_EOL; + $inactiveBridges .= displayBridgeCard($bridgeName, $formats, false) . PHP_EOL; } } echo '
' . $inactiveBridges; ?> + + diff --git a/lib/Bridge.php b/lib/Bridge.php index f4960b9e..e0632778 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -9,12 +9,28 @@ interface BridgeInterface{ public function getName(); public function getURI(); public function getCacheDuration(); + public function loadMetadatas(); } abstract class BridgeAbstract implements BridgeInterface{ + protected $cache; protected $items = array(); + public $name = "Bridge sans nom"; + public $homepage = ""; + public $description = 'No description provided'; + public $maintainer = 'No maintainer'; + public $parameters = array(); + + /** + * Loads the Bridge Metadatas + */ + public function loadMetadatas() { + + + } + /** * Launch probative exception */ @@ -30,6 +46,8 @@ abstract class BridgeAbstract implements BridgeInterface{ return $this->items; } + + /** * Defined datas with parameters depending choose bridge * Note : you can defined a cache before with "setCache" From 1c869631d67db9b009c23e92f3428e3a42427fbf Mon Sep 17 00:00:00 2001 From: teromene Date: Tue, 3 Nov 2015 14:36:19 +0000 Subject: [PATCH 02/15] =?UTF-8?q?Ajout=20d'options=20multiples=20pour=20le?= =?UTF-8?q?s=20m=C3=A9ta-donn=C3=A9es.=20Ajout=20d'un=20bridge=20de=20d?= =?UTF-8?q?=C3=A9monstration,=20DemoBridge.=20Ajout=20d'un=20d=C3=A9but=20?= =?UTF-8?q?de=20documentation=20pour=20cr=C3=A9er=20un=20bridge=20dans=20C?= =?UTF-8?q?REATE=5FBRIDGE.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CREATE_BRIDGE.md | 23 ++++++++++++ bridges/AcrimedBridge.php | 20 +++++----- bridges/Arte7Bridge.php | 40 ++++++++++++++++++++ bridges/DemoBridge.php | 72 +++++++++++++++++++++++++++++++++++ bridges/FacebookBridge.php | 2 +- index.php | 26 +++++++++---- lib/Bridge.php | 77 +++++++------------------------------- 7 files changed, 179 insertions(+), 81 deletions(-) create mode 100644 CREATE_BRIDGE.md create mode 100644 bridges/DemoBridge.php diff --git a/CREATE_BRIDGE.md b/CREATE_BRIDGE.md new file mode 100644 index 00000000..215ae282 --- /dev/null +++ b/CREATE_BRIDGE.md @@ -0,0 +1,23 @@ +# Howto create a bridge + +A bridge is an interface that allows rss-bridge to create a RSS feed from a website. +The bridge is a PHP file, located in the `bridges/` folder. + +##Specifications + +A rss bridge must extend the `BridgeAbstract` class, and implement the following functions : + +* The `loadMetadatas` function, described below, +* The `getCacheDuration` function, describing the time during which rss-bridge will output cached values instead of re-generating a RSS feed. +* The `collectData` function, also described below. + +##The `collectData` function + +This function takes as a parameter an array called `$param`, that is automatically filled with values from the user, according to the values setted in `loadMetadatas`. +This function is the place where all the website scrapping and the RSS feed generation process will go. + +The RSS elements are stored in the class variable `items[]`. + +Every RSS element is an instance of the `Item` class. + + diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index 97a2e4a7..d50a0d66 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -1,6 +1,6 @@ maintainer = "qwertygc"; + $this->name = "Acrimed Bridge"; + $this->uri = "http://www.acrimed.org/"; + $this->description = "Returns the newest articles."; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ function StripCDATA($string) { $string = str_replace('maintainer = "mitsukarenai"; + $this->name = "Arte +7"; + $this->uri = "http://www.arte.tv/"; + $this->description = "Returns newest videos from ARTE +7"; + $this->update = "2015-10-31"; + $this->parameters["Catégorie (Français)"] = + '[ + { + "type" : "list", + "identifier" : "catfr", + "name" : "Catégorie", + "values" : [ + { + "name" : "Toutes les vidéos (français)", + "value" : "toutes-les-videos" + }, + { + "name" : "Actu & société", + "value" : "actu-société" + }, + { + "name" : "Séries & fiction", + "value" : "séries-fiction" + }, + { + "name" : "Cinéma", + "value" : "cinéma" + } + + ] + + + } + + ]'; + } + + public function collectData(array $param){ function extractVideoset($category='toutes-les-videos', $lang='fr') diff --git a/bridges/DemoBridge.php b/bridges/DemoBridge.php new file mode 100644 index 00000000..df38be6b --- /dev/null +++ b/bridges/DemoBridge.php @@ -0,0 +1,72 @@ +maintainer = "teromene"; + $this->name = "DemoBridge"; + $this->uri = "http://github.com/sebsauvage/rss-bridge"; + $this->description = "Bridge used for demos"; + $this->update = "2015-11-03"; + + $this->parameters['testCheckbox'] = + '[ + { + "type" : "checkbox", + "identifier" : "testCheckbox", + "name" : "test des checkbox" + } + + ]'; + + $this->parameters['testList'] = + '[ + { + "type" : "list", + "identifier" : "testList", + "name" : "test des listes", + "values" : [ + { + "name" : "Test", + "value" : "test" + }, + { + "name" : "Test 2", + "value" : "test2" + } + ] + } + ]'; + $this->parameters['testNumber'] = + '[ + { + "type" : "number", + "identifier" : "testNumber", + "name" : "test des numéros", + "exampleValue" : "1515632" + + } + + ]'; + + } + + public function collectData(array $param){ + + } + + public function getCacheDuration(){ + return 3600; // 1 hour + } +} diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index 15f648ca..dc37d5ec 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -9,7 +9,7 @@ */ class FacebookBridge extends BridgeAbstract{ - private $name; + public function collectData(array $param){ diff --git a/index.php b/index.php index 494ebb39..5a4dea80 100644 --- a/index.php +++ b/index.php @@ -96,14 +96,14 @@ try{ $bridge->setCache($cache); // just add disable cache to your query to disable caching } $bridge->setDatas($_REQUEST); - + $bridge->loadMetadatas(); // Data transformation $format = Format::create($format); $format ->setDatas($bridge->getDatas()) ->setExtraInfos(array( - 'name' => $bridge->getName(), - 'uri' => $bridge->getURI(), + 'name' => $bridge->name, + 'uri' => $bridge->uri, )) ->display(); die; @@ -143,7 +143,7 @@ function displayBridgeCard($bridgeName, $formats, $isActive = true) $bridgeElement = Bridge::create($bridgeName); $bridgeElement->loadMetadatas(); - $name = ''.$bridgeElement->name.''; + $name = ''.$bridgeElement->name.''; $description = $bridgeElement->description; $card = <<parameters) == 0) { - $card .= '
+ $card .= ' ' . PHP_EOL; @@ -177,7 +177,7 @@ CARD; { $card .= '
    ' . PHP_EOL; $card .= '
    '.$parameterName.'
    ' . PHP_EOL; - $card .= ' + $card .= ' ' . PHP_EOL; @@ -193,6 +193,18 @@ CARD; $card .= '
    ' . PHP_EOL; } else if($inputEntry['type'] == 'number') { $card .= '
    ' . PHP_EOL; + } else if($inputEntry['type'] == 'list') { + $card .= '
    '; + } else if($inputEntry['type'] == 'checkbox') { + + $card .= '
    ' . PHP_EOL; + } } @@ -240,7 +252,7 @@ $formats = Format::searchInformation(); $activeFoundBridgeCount = 0; $showInactive = isset($_REQUEST['show_inactive']) && $_REQUEST['show_inactive'] == 1; $inactiveBridges = ''; - foreach($whitelist_selection as $bridgeName) + foreach(Bridge::listBridges() as $bridgeName) { if(BridgeWhitelist($whitelist_selection, $bridgeName)) { diff --git a/lib/Bridge.php b/lib/Bridge.php index e0632778..29ac6d2a 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -6,8 +6,6 @@ interface BridgeInterface{ public function collectData(array $param); - public function getName(); - public function getURI(); public function getCacheDuration(); public function loadMetadatas(); } @@ -18,7 +16,7 @@ abstract class BridgeAbstract implements BridgeInterface{ protected $items = array(); public $name = "Bridge sans nom"; - public $homepage = ""; + public $uri = ""; public $description = 'No description provided'; public $maintainer = 'No maintainer'; public $parameters = array(); @@ -257,74 +255,25 @@ class Bridge{ } /** - * Read bridge dir and catch informations about each bridge depending annotation - * @return array Informations about each bridge + * Lists the available bridges. + * @return array List of the bridges */ - static public function searchInformation(){ + static public function listBridges() { + $pathDirBridge = self::getDir(); - $listBridge = array(); + $dirFiles = scandir($pathDirBridge); - $searchCommonPattern = array('maintainer', 'description', 'homepage', 'name'); - - $dirFiles = scandir($pathDirBridge); if( $dirFiles !== false ){ foreach( $dirFiles as $fileName ){ - if( preg_match('@([^.]+)\.php@U', $fileName, $out) ){ // Is PHP file ? - $infos = array(); // Information about the bridge - $resParse = token_get_all(file_get_contents($pathDirBridge . $fileName)); // Parse PHP file - foreach($resParse as $v){ - if( is_array($v) && $v[0] == T_DOC_COMMENT ){ // Lexer node is COMMENT ? - $commentary = $v[1]; - foreach( $searchCommonPattern as $name){ // Catch information with common pattern - preg_match('#@' . preg_quote($name, '#') . '\s+(.+)#', $commentary, $outComment); - if( isset($outComment[1]) ){ - $infos[$name] = $outComment[1]; - } - } + if( preg_match('@([^.]+)\.php@U', $fileName, $out) ){ + $listBridge[] = $out[1]; + } + } + } - preg_match_all('#@use(?[1-9][0-9]*)\s?\((?.+)\)(?:\r|\n)#', $commentary, $outComment); // Catch specific information about "use". + return $listBridge; + } - if( isset($outComment['args']) && is_array($outComment['args']) ){ - $infos['use'] = array(); - - foreach($outComment['args'] as $num => $args){ // Each use - - preg_match_all('#(?[a-z]+)\|(?[a-z]+)="(?.*)"(?:,|$)#U', $args, $outArg); // Catch arguments for current use - - if(!isset($outArg['name']) || count($outArg['name']) == 0) { - preg_match_all('#(?[a-z]+)="(?.*)"(?:,|$)#U', $args, $outArg); // Catch arguments - } - - - if( isset($outArg['name'])){ - $usePos = $outComment['num'][$num]; // Current use name - if( !isset($infos['use'][$usePos]) ){ // Not information actually for this "use" ? - $infos['use'][$usePos] = array(); - } - - foreach($outArg['name'] as $numArg => $name){ // Each arguments - $infos['use'][$usePos][$name] = array(); - - $infos['use'][$usePos][$name]['query-name'] = $name; - $infos['use'][$usePos][$name]['value'] = $outArg['value'][$numArg]; - $infos['use'][$usePos][$name]['type'] = $outArg['type'][$numArg]; - - } - } - } - } - } - } - - if( isset($infos['name']) ){ // If informations containt at least a name - $listBridge[$out[1]] = $infos; - } - } - } - } - - return $listBridge; - } } From 894eadbbda6c968d92cc2230a12bbf7a97d84bc7 Mon Sep 17 00:00:00 2001 From: teromene Date: Tue, 3 Nov 2015 22:28:44 +0000 Subject: [PATCH 03/15] =?UTF-8?q?Premier=20lot=20de=20bridges=20utilisant?= =?UTF-8?q?=20le=20premier=20syst=C3=A8me.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: teromene --- bridges/ABCTabsBridge.php | 32 ++++++++++--------------- bridges/AcrimedBridge.php | 9 +------ bridges/BastaBridge.php | 23 +++++++++--------- bridges/BlaguesDeMerdeBridge.php | 18 +++++++------- bridges/CADBridge.php | 22 ++++++++--------- bridges/CoinDeskBridge.php | 20 ++++++++-------- bridges/CollegeDeFranceBridge.php | 21 ++++++++-------- bridges/CommonDreamsBridge.php | 22 ++++++++--------- bridges/CopieDoubleBridge.php | 19 ++++++++------- bridges/CourrierInternationalBridge.php | 19 ++++++++------- bridges/DansTonChatBridge.php | 21 ++++++++-------- bridges/DemoBridge.php | 11 --------- bridges/DeveloppezDotComBridge.php | 20 ++++++++-------- bridges/DilbertBridge.php | 19 ++++++++------- bridges/FSBridge.php | 18 ++++++-------- bridges/FootitoBridge.php | 18 +++++++------- bridges/FrandroidBridge.php | 19 +++++++-------- bridges/GizmodoFRBridge.php | 20 ++++++++-------- bridges/GuruMedBridge.php | 17 ++++++------- bridges/KoreusBridge.php | 20 ++++++++-------- bridges/LeJournalDuGeekBridge.php | 20 ++++++++-------- bridges/LeMondeInformatiqueBridge.php | 21 ++++++++-------- bridges/LeMotDuJourBridge.php | 17 +++++++------ bridges/Les400Culs.php | 17 ++++++++----- bridges/LesJoiesDuCodeBridge.php | 18 +++++++------- 25 files changed, 233 insertions(+), 248 deletions(-) diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index f0973b6a..ac0772de 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -1,19 +1,18 @@ maintainer = "kranack"; + $this->name = "ABC Tabs Bridge"; + $this->uri = "http://www.abc-tabs.com/"; + $this->description = "Returns 22 newest tabs"; + $this->update = "2014-07-23"; + + } + 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); @@ -30,13 +29,6 @@ class ABCTabsBridge extends BridgeAbstract{ $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 diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index d50a0d66..ae573f86 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -1,13 +1,6 @@ maintainer = "qwertygc"; diff --git a/bridges/BastaBridge.php b/bridges/BastaBridge.php index 976240fe..0b84ff39 100644 --- a/bridges/BastaBridge.php +++ b/bridges/BastaBridge.php @@ -1,16 +1,17 @@ maintainer = "qwertygc"; + $this->name = "Bastamag Bridge"; + $this->uri = "http://www.bastamag.net/"; + $this->description = "Returns the newest articles."; + $this->update = "2014-05-25"; + + } + + public function collectData(array $param){ diff --git a/bridges/BlaguesDeMerdeBridge.php b/bridges/BlaguesDeMerdeBridge.php index c7caed6f..2ba230f9 100644 --- a/bridges/BlaguesDeMerdeBridge.php +++ b/bridges/BlaguesDeMerdeBridge.php @@ -1,14 +1,16 @@ maintainer = "superbaillot.net"; + $this->name = "Blagues De Merde"; + $this->uri = "http://www.blaguesdemerde.fr/"; + $this->description = "Blagues De Merde"; + $this->update = "16/10/2013"; + + } + public function collectData(array $param){ $html = file_get_html('http://www.blaguesdemerde.fr/') or $this->returnError('Could not request BDM.', 404); diff --git a/bridges/CADBridge.php b/bridges/CADBridge.php index 8238eaf9..28ef697e 100644 --- a/bridges/CADBridge.php +++ b/bridges/CADBridge.php @@ -1,16 +1,16 @@ maintainer = "nyutag"; + $this->name = "CAD Bridge"; + $this->uri = "http://www.cad-comic.com/"; + $this->description = "Returns the newest articles."; + $this->update = "2015-04-03"; + + } + public function collectData(array $param){ function CADUrl($string) { diff --git a/bridges/CoinDeskBridge.php b/bridges/CoinDeskBridge.php index 6dc5a090..79c30ebd 100644 --- a/bridges/CoinDeskBridge.php +++ b/bridges/CoinDeskBridge.php @@ -1,16 +1,16 @@ maintainer = "mitsukarenai"; + $this->name = "CoinDesk"; + $this->uri = "http://www.coindesk.com/"; + $this->description = "Returns the 5 newest posts from CoinDesk (full text)"; + $this->update = "2014-05-30"; + + } + public function collectData(array $param){ function CoinDeskStripCDATA($string) { diff --git a/bridges/CollegeDeFranceBridge.php b/bridges/CollegeDeFranceBridge.php index 6526eaea..e9e0dbc0 100644 --- a/bridges/CollegeDeFranceBridge.php +++ b/bridges/CollegeDeFranceBridge.php @@ -1,15 +1,16 @@ maintainer = "pit-fgfjiudghdf"; + $this->name = "CollegeDeFrance"; + $this->uri = "http://www.college-de-france.fr/"; + $this->description = "Returns the 10 newest posts from CollegeDeFrance"; + $this->update = "2014-05-26"; + + } + public function collectData(array $param){ $find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre'); $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); diff --git a/bridges/CommonDreamsBridge.php b/bridges/CommonDreamsBridge.php index 07247e56..2a30f37e 100644 --- a/bridges/CommonDreamsBridge.php +++ b/bridges/CommonDreamsBridge.php @@ -1,16 +1,16 @@ maintainer = "nyutag"; + $this->name = "CommonDreams Bridge"; + $this->uri = "http://www.commondreams.org/"; + $this->description = "Returns the newest articles."; + $this->update = "2015-04-03"; + + } + public function collectData(array $param){ function CommonDreamsUrl($string) { diff --git a/bridges/CopieDoubleBridge.php b/bridges/CopieDoubleBridge.php index c163bf6b..12b3a8a9 100644 --- a/bridges/CopieDoubleBridge.php +++ b/bridges/CopieDoubleBridge.php @@ -1,14 +1,17 @@ maintainer = "superbaillot.net"; + $this->name = "CopieDouble"; + $this->uri = "http://www.copie-double.com/"; + $this->description = "CopieDouble"; + $this->update = "12/12/2013"; + + } + + public function collectData(array $param){ $html = file_get_html('http://www.copie-double.com/') or $this->returnError('Could not request CopieDouble.', 404); $table = $html->find('table table', 2); diff --git a/bridges/CourrierInternationalBridge.php b/bridges/CourrierInternationalBridge.php index 2ad5899d..a7ff8b03 100644 --- a/bridges/CourrierInternationalBridge.php +++ b/bridges/CourrierInternationalBridge.php @@ -1,15 +1,16 @@ maintainer = "teromene"; + $this->name = "CourrierInternational"; + $this->uri = "http://CourrierInternational.fr/"; + $this->description = "Courrier International bridge"; + $this->update = "01/09/2015"; + + } + public function collectData(array $param){ function fetchArticle($link) { diff --git a/bridges/DansTonChatBridge.php b/bridges/DansTonChatBridge.php index 7e2e69e0..95a1cf5a 100644 --- a/bridges/DansTonChatBridge.php +++ b/bridges/DansTonChatBridge.php @@ -1,17 +1,16 @@ maintainer = "Astalaseven"; + $this->name = "DansTonChat Bridge"; + $this->uri = "http://danstonchat.com/latest.html"; + $this->description = "Returns latest quotes from DansTonChat."; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ $html = ''; $link = 'http://danstonchat.com/latest.html'; diff --git a/bridges/DemoBridge.php b/bridges/DemoBridge.php index df38be6b..7c87675c 100644 --- a/bridges/DemoBridge.php +++ b/bridges/DemoBridge.php @@ -1,15 +1,4 @@ maintainer = "polopollo"; + $this->name = "Developpez.com Actus (FR)"; + $this->uri = "http://www.developpez.com/"; + $this->description = "Returns the 15 newest posts from DeveloppezDotCom (full text)."; + $this->update = "2014-07-14"; + + } + public function collectData(array $param){ function DeveloppezDotComStripCDATA($string) { diff --git a/bridges/DilbertBridge.php b/bridges/DilbertBridge.php index d56986c2..30cbb1c6 100644 --- a/bridges/DilbertBridge.php +++ b/bridges/DilbertBridge.php @@ -1,15 +1,16 @@ maintainer = "kranack"; + $this->name = "Dilbert Daily Strip"; + $this->uri = "http://dilbert.com/strips/"; + $this->description = "The Unofficial Dilbert Daily Comic Strip"; + $this->update = "30/01/2015"; + + } + public function collectData(array $param){ $html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404); diff --git a/bridges/FSBridge.php b/bridges/FSBridge.php index bc550133..11334d52 100644 --- a/bridges/FSBridge.php +++ b/bridges/FSBridge.php @@ -1,19 +1,15 @@ maintainer = "qwertygc"; + $this->name = "Futurasciences"; + $this->uri = "http://www.futura-sciences.com"; + $this->description = "Returns the 5 newest posts from FS (full text)"; + $this->update = "03/11/2015"; - + } public function collectData(array $param){ diff --git a/bridges/FootitoBridge.php b/bridges/FootitoBridge.php index 2731d5c7..467f0429 100644 --- a/bridges/FootitoBridge.php +++ b/bridges/FootitoBridge.php @@ -1,14 +1,16 @@ maintainer = "superbaillot.net"; + $this->name = "Footito"; + $this->uri = "http://www.footito.fr/"; + $this->description = "Footito"; + $this->update = "21/11/2013"; + + } + public function collectData(array $param){ $html = file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404); diff --git a/bridges/FrandroidBridge.php b/bridges/FrandroidBridge.php index 7ee6c9c9..80aac5db 100644 --- a/bridges/FrandroidBridge.php +++ b/bridges/FrandroidBridge.php @@ -1,16 +1,15 @@ maintainer = "Daiyousei"; + $this->name = "Frandroid"; + $this->uri = "http://www.frandroid.com/"; + $this->description = "Returns the RSS feed from Frandroid (full text articles)"; + $this->update = "2015-03-05"; + + } public function collectData(array $param) { diff --git a/bridges/GizmodoFRBridge.php b/bridges/GizmodoFRBridge.php index b2e8a21e..bb19fc3d 100644 --- a/bridges/GizmodoFRBridge.php +++ b/bridges/GizmodoFRBridge.php @@ -1,16 +1,16 @@ maintainer = "polopollo"; + $this->name = "GizmodoFR"; + $this->uri = "http://www.gizmodo.fr/"; + $this->description = "Returns the 15 newest posts from GizmodoFR (full text)."; + $this->update = "2014-07-14"; + + } + public function collectData(array $param){ function GizmodoFRExtractContent($url) { diff --git a/bridges/GuruMedBridge.php b/bridges/GuruMedBridge.php index 032148bd..de836cb3 100644 --- a/bridges/GuruMedBridge.php +++ b/bridges/GuruMedBridge.php @@ -1,18 +1,15 @@ maintainer = "qwertygc"; + $this->name = "GuruMed"; + $this->uri = "http://www.gurumed.org"; + $this->description = "Returns the 5 newest posts from Gurumed (full text)"; + $this->update = "03/10/2015"; - + } public function collectData(array $param){ diff --git a/bridges/KoreusBridge.php b/bridges/KoreusBridge.php index 8ae90e8a..af99bf20 100644 --- a/bridges/KoreusBridge.php +++ b/bridges/KoreusBridge.php @@ -1,16 +1,16 @@ maintainer = "pit-fgfjiudghdf"; + $this->name = "Koreus"; + $this->uri = "http://www.koreus.com/"; + $this->description = "Returns the 5 newest posts from Koreus (full text)"; + $this->update = "2014-05-26"; + + } + public function collectData(array $param){ function KoreusStripCDATA($string) { diff --git a/bridges/LeJournalDuGeekBridge.php b/bridges/LeJournalDuGeekBridge.php index 07559012..5ed3b5e5 100644 --- a/bridges/LeJournalDuGeekBridge.php +++ b/bridges/LeJournalDuGeekBridge.php @@ -1,16 +1,16 @@ maintainer = "polopollo"; + $this->name = "journaldugeek.com (FR)"; + $this->uri = "http://www.journaldugeek.com/"; + $this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; + $this->update = "2014-07-14"; + + } + public function collectData(array $param){ function LeJournalDuGeekStripCDATA($string) { diff --git a/bridges/LeMondeInformatiqueBridge.php b/bridges/LeMondeInformatiqueBridge.php index f007fb01..a0c16b2b 100644 --- a/bridges/LeMondeInformatiqueBridge.php +++ b/bridges/LeMondeInformatiqueBridge.php @@ -1,17 +1,16 @@ maintainer = "ORelio"; + $this->name = "Le Monde Informatique"; + $this->uri = "http://www.lemondeinformatique.fr/"; + $this->description = "Returns the newest articles."; + $this->update = "2015-09-08"; + + } + public function collectData(array $param) { function StripCDATA($string) { diff --git a/bridges/LeMotDuJourBridge.php b/bridges/LeMotDuJourBridge.php index 9149449b..8ea8ee61 100644 --- a/bridges/LeMotDuJourBridge.php +++ b/bridges/LeMotDuJourBridge.php @@ -1,12 +1,15 @@ maintainer = "qwertygc"; + $this->name = "LeMotDuJour Bridge"; + $this->uri = "http://www.lemotdujour.com/"; + $this->description = "Returns the newest articles."; + $this->update = "2014-05-25"; + + } public function collectData(array $param){ diff --git a/bridges/Les400Culs.php b/bridges/Les400Culs.php index f01e3646..dcb17ae8 100644 --- a/bridges/Les400Culs.php +++ b/bridges/Les400Culs.php @@ -1,10 +1,4 @@ maintainer = "unknown"; + $this->name = "Les 400 Culs"; + $this->uri = "http://sexes.blogs.liberation.fr"; + $this->description = "La planète sexe vue par Agnès Girard via rss-bridge"; + $this->update = "20/02/2014"; + + } + + public function collectData(array $param){ $param['url'] = RSS; parent::collectData($param); diff --git a/bridges/LesJoiesDuCodeBridge.php b/bridges/LesJoiesDuCodeBridge.php index d9cc0028..2dd1c44b 100644 --- a/bridges/LesJoiesDuCodeBridge.php +++ b/bridges/LesJoiesDuCodeBridge.php @@ -1,14 +1,16 @@ maintainer = "superbaillot.net"; + $this->name = "Les Joies Du Code"; + $this->uri = "http://lesjoiesducode.fr/"; + $this->description = "LesJoiesDuCode"; + $this->update = "04/02/2015"; + + } + public function collectData(array $param){ $html = file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404); From a5a959dceda562435599f0023be33d3eb5acd8eb Mon Sep 17 00:00:00 2001 From: teromene Date: Tue, 3 Nov 2015 23:05:10 +0000 Subject: [PATCH 04/15] =?UTF-8?q?Correction=20de=20quelques=20bugs=20dans?= =?UTF-8?q?=20les=20bridges,=20qui=20apparaissent=20=C3=A0=20cause=20du=20?= =?UTF-8?q?fait=20qu'ils=20sont=20tous=20instanci=C3=A9s=20lors=20du=20cha?= =?UTF-8?q?rgement=20de=20tout=20les=20bridges.=20R=C3=A9-ajout=20et=20r?= =?UTF-8?q?=C3=A9-utilisation=20de=20getName=20et=20getURI,=20qui=20permet?= =?UTF-8?q?tent=20d'avoir=20des=20=C3=A9lements=20dynamiques.=20Changement?= =?UTF-8?q?=20en=20public=20de=20certaines=20valeurs.=20Changement=20du=20?= =?UTF-8?q?nom=20de=20certaines=20constantes,=20d=C3=A9ja=20utilis=C3=A9s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: teromene --- bridges/ABCTabsBridge.php | 12 ++++++++++++ bridges/AcrimedBridge.php | 11 +++++++++++ bridges/DemoBridge.php | 12 ++++++++++++ bridges/GiphyBridge.php | 2 +- bridges/Les400Culs.php | 4 ++-- bridges/RssExpander.php | 8 ++++---- bridges/SoundcloudBridge.php | 2 +- bridges/TheOatMealBridge.php | 4 ++-- bridges/WhydBridge.php | 2 +- bridges/WordPressBridge.php | 2 +- bridges/WorldOfTanks.php | 4 ++-- index.php | 8 ++++++-- lib/Bridge.php | 21 ++++++++++++++++++++- 13 files changed, 75 insertions(+), 17 deletions(-) diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index ac0772de..7481f3a1 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -30,6 +30,18 @@ class ABCTabsBridge extends BridgeAbstract{ } } + public function getName() { + + return "ABC Tabs Bridge"; + + } + + public function getURI() { + + return "http://www.abc-tabs.com/"; + + } + public function getCacheDuration(){ return 3600; // 1 hour } diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index ae573f86..d0f5abfc 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -39,6 +39,17 @@ class AcrimedBridge extends BridgeAbstract{ } + public function getName() { + + return "Acrimed Bridge"; + + } + + public function getURI() { + + return "http://www.acrimed.org/"; + + } public function getCacheDuration(){ return 3600*2; // 2 hours diff --git a/bridges/DemoBridge.php b/bridges/DemoBridge.php index 7c87675c..24cd3891 100644 --- a/bridges/DemoBridge.php +++ b/bridges/DemoBridge.php @@ -55,6 +55,18 @@ class DemoBridge extends BridgeAbstract{ } + public function getName() { + + return "DemoBridge"; + + } + + public function getURI() { + + return "http://github.com/sebsauvage/rss-bridge"; + + } + public function getCacheDuration(){ return 3600; // 1 hour } diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php index b0a4f899..f3c0d99b 100644 --- a/bridges/GiphyBridge.php +++ b/bridges/GiphyBridge.php @@ -12,7 +12,7 @@ * @use2(n="max number of returned items") */ -define(GIPHY_LIMIT, 10); +define('GIPHY_LIMIT', 10); class GiphyBridge extends BridgeAbstract{ diff --git a/bridges/Les400Culs.php b/bridges/Les400Culs.php index dcb17ae8..4694f406 100644 --- a/bridges/Les400Culs.php +++ b/bridges/Les400Culs.php @@ -1,7 +1,7 @@ returnError('There is no $param[\'url\'] for this RSS expander', 404); @@ -65,4 +65,4 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{ public function getDescription() { return $this->description; } -} \ No newline at end of file +} diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 05c807bc..7bcc6d0a 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -14,7 +14,7 @@ class SoundCloudBridge extends BridgeAbstract{ private $request; - private $name; + public $name; const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875'; public function collectData(array $param){ diff --git a/bridges/TheOatMealBridge.php b/bridges/TheOatMealBridge.php index 84b6954b..7342ec2b 100644 --- a/bridges/TheOatMealBridge.php +++ b/bridges/TheOatMealBridge.php @@ -10,11 +10,11 @@ */ require_once 'bridges/RssExpander.php'; define("THE_OATMEAL", "http://theoatmeal.com/"); -define("RSS", "http://feeds.feedburner.com/oatmealfeed"); +define("THE_OATMEAL_RSS", "http://feeds.feedburner.com/oatmealfeed"); class TheOatmealBridge extends RssExpander{ public function collectData(array $param){ - $param['url'] = RSS; + $param['url'] = THE_OATMEAL_RSS; parent::collectData($param); } diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php index 9bac7a05..060a7b62 100644 --- a/bridges/WhydBridge.php +++ b/bridges/WhydBridge.php @@ -14,7 +14,7 @@ class WhydBridge extends BridgeAbstract{ private $request; - private $name; + public $name; public function collectData(array $param){ $html = ''; diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index a2eee25b..2a182df3 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -14,7 +14,7 @@ class WordPressBridge extends BridgeAbstract { private $url; - private $name; + public $name; public function collectData(array $param) { $this->processParams($param); diff --git a/bridges/WorldOfTanks.php b/bridges/WorldOfTanks.php index ccc80bf5..f4de4773 100644 --- a/bridges/WorldOfTanks.php +++ b/bridges/WorldOfTanks.php @@ -10,8 +10,8 @@ define('WORLD_OF_TANKS', 'http://worldoftanks.eu/'); define('NEWS', '/news/'); class WorldOfTanks extends HttpCachingBridgeAbstract{ private $lang = "fr"; - private $uri = WORLD_OF_TANKS; - private $name = 'World of tanks news'; + public $uri = WORLD_OF_TANKS; + public $name = 'World of tanks news'; public function collectData(array $param){ if (!empty($param['lang'])) { diff --git a/index.php b/index.php index 5a4dea80..30dee333 100644 --- a/index.php +++ b/index.php @@ -102,8 +102,8 @@ try{ $format ->setDatas($bridge->getDatas()) ->setExtraInfos(array( - 'name' => $bridge->name, - 'uri' => $bridge->uri, + 'name' => $bridge->getName(), + 'uri' => $bridge->getURI(), )) ->display(); die; @@ -140,7 +140,11 @@ function getHelperButtonsFormat($formats){ function displayBridgeCard($bridgeName, $formats, $isActive = true) { + $bridgeElement = Bridge::create($bridgeName); + if($bridgeElement == false) { + return ""; + } $bridgeElement->loadMetadatas(); $name = ''.$bridgeElement->name.''; diff --git a/lib/Bridge.php b/lib/Bridge.php index 29ac6d2a..b4945202 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -8,6 +8,8 @@ interface BridgeInterface{ public function collectData(array $param); public function getCacheDuration(); public function loadMetadatas(); + public function getName(); + public function getURI(); } abstract class BridgeAbstract implements BridgeInterface{ @@ -207,6 +209,19 @@ class Bridge{ throw new \LogicException('Please use ' . __CLASS__ . '::create for new object.'); } + /** + * Checks if a bridge is an instantiable bridge. + * @param string $nameBridge name of the bridge that you want to use + * @return true if it is an instantiable bridge, false otherwise. + */ + static public function isInstantiable($nameBridge) { + + $re = new ReflectionClass($nameBridge); + return $re->IsInstantiable(); + + } + + /** * Create a new bridge object * @param string $nameBridge Defined bridge name you want use @@ -225,7 +240,11 @@ class Bridge{ require_once $pathBridge; - return new $nameBridge(); + if(Bridge::isInstantiable($nameBridge)) { + return new $nameBridge(); + } else { + return FALSE; + } } static public function setDir($dirBridge){ From 1efaba5c7c9de113cc073ae293ac8a2939acaa67 Mon Sep 17 00:00:00 2001 From: teromene Date: Wed, 4 Nov 2015 09:47:21 +0000 Subject: [PATCH 05/15] =?UTF-8?q?Deuxi=C3=A8me=20lot=20de=20bridges.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridges/MalikiBridge.php | 20 ++++++++++---------- bridges/MemoLinuxBridge.php | 17 ++++++++++------- bridges/MondeDiploBridge.php | 22 ++++++++++------------ bridges/MsnMondeBridge.php | 20 ++++++++++---------- bridges/NasaApodBridge.php | 17 ++++++++++------- bridges/NextInpactBridge.php | 21 ++++++++++----------- bridges/NiceMatinBridge.php | 20 ++++++++++---------- bridges/NumeramaBridge.php | 20 ++++++++++---------- bridges/OpenTheoryBridge.php | 17 +++++++---------- bridges/PlanetLibreBridge.php | 21 +++++++++++---------- bridges/ProjectMGameBridge.php | 18 +++++++++++------- bridges/TwitchApiBridge.php | 4 ++-- 12 files changed, 111 insertions(+), 106 deletions(-) diff --git a/bridges/MalikiBridge.php b/bridges/MalikiBridge.php index 29e4cfa5..de871200 100644 --- a/bridges/MalikiBridge.php +++ b/bridges/MalikiBridge.php @@ -1,16 +1,16 @@ maintainer = "mitsukarenai"; + $this->name = "Maliki"; + $this->uri = "http://www.maliki.com/"; + $this->description = "Returns Maliki's newest strips"; + $this->update = "2014-05-30"; + + } + public function collectData(array $param){ $html = file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404); $count=0; diff --git a/bridges/MemoLinuxBridge.php b/bridges/MemoLinuxBridge.php index 7da5ba0f..02d7ac70 100644 --- a/bridges/MemoLinuxBridge.php +++ b/bridges/MemoLinuxBridge.php @@ -1,13 +1,16 @@ maintainer = "qwertygc"; + $this->name = "MemoLinux"; + $this->uri = "http://memo-linux.com/"; + $this->description = "Returns the 10 newest posts from MemoLinux (full text)"; + $this->update = "2015-01-30"; + + } + public function collectData(array $param){ function StripCDATA($string) { diff --git a/bridges/MondeDiploBridge.php b/bridges/MondeDiploBridge.php index 2077205e..3774be86 100644 --- a/bridges/MondeDiploBridge.php +++ b/bridges/MondeDiploBridge.php @@ -1,18 +1,16 @@ maintainer = "Pitchoule"; + $this->name = "MondeDiplo"; + $this->uri = "http://www.monde-diplomatique.fr"; + $this->description = "Returns most recent results from MondeDiplo."; + $this->update = "2014-07-22"; + + } + public function collectData(array $param){ $link = 'http://www.monde-diplomatique.fr'; diff --git a/bridges/MsnMondeBridge.php b/bridges/MsnMondeBridge.php index 0d2e4711..1a63da63 100644 --- a/bridges/MsnMondeBridge.php +++ b/bridges/MsnMondeBridge.php @@ -1,16 +1,16 @@ maintainer = "kranack"; + $this->name = "MSN Actu Monde"; + $this->uri = "http://www.msn.com/fr-fr/actualite/monde"; + $this->description = "Returns the 10 newest posts from MSN Actualités (full text)"; + $this->update = "2015-01-30"; + + } + public function collectData(array $param){ function MsnMondeExtractContent($url, &$item) { diff --git a/bridges/NasaApodBridge.php b/bridges/NasaApodBridge.php index f3f76209..63c8c93e 100644 --- a/bridges/NasaApodBridge.php +++ b/bridges/NasaApodBridge.php @@ -1,13 +1,16 @@ maintainer = "corenting"; + $this->name = "NASA APOD Bridge"; + $this->uri = "http://apod.nasa.gov/apod/astropix.html"; + $this->description = "Returns the 3 latest NASA APOD pictures and explanations"; + $this->update = "2014-08-27"; + + } + public function collectData(array $param) { $html = file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnError('Error while downloading the website content', 404); diff --git a/bridges/NextInpactBridge.php b/bridges/NextInpactBridge.php index c070038a..107f3e72 100644 --- a/bridges/NextInpactBridge.php +++ b/bridges/NextInpactBridge.php @@ -1,17 +1,16 @@ maintainer = "qwertygc"; + $this->name = "NextInpact Bridge"; + $this->uri = "http://www.nextinpact.com/"; + $this->description = "Returns the newest articles."; + $this->update = "2015-10-23"; + + } + public function collectData(array $param) { function StripCDATA($string) { diff --git a/bridges/NiceMatinBridge.php b/bridges/NiceMatinBridge.php index 7c0441a6..bbfe4d83 100644 --- a/bridges/NiceMatinBridge.php +++ b/bridges/NiceMatinBridge.php @@ -1,16 +1,16 @@ maintainer = "pit-fgfjiudghdf"; + $this->name = "NiceMatin"; + $this->uri = "http://www.nicematin.com/"; + $this->description = "Returns the 10 newest posts from NiceMatin (full text)"; + $this->update = "2014-05-26"; + + } + public function collectData(array $param){ function NiceMatinUrl($string) { diff --git a/bridges/NumeramaBridge.php b/bridges/NumeramaBridge.php index cc7e2f2e..f1958a40 100644 --- a/bridges/NumeramaBridge.php +++ b/bridges/NumeramaBridge.php @@ -1,16 +1,16 @@ maintainer = "mitsukarenai"; + $this->name = "Numerama"; + $this->uri = "http://www.numerama.com/"; + $this->description = "Returns the 5 newest posts from Numerama (full text)"; + $this->update = "2015-10-12"; + + } + public function collectData(array $param){ function NumeramaStripCDATA($string) { diff --git a/bridges/OpenTheoryBridge.php b/bridges/OpenTheoryBridge.php index 9117d372..ebafa330 100644 --- a/bridges/OpenTheoryBridge.php +++ b/bridges/OpenTheoryBridge.php @@ -1,18 +1,15 @@ maintainer = "qwertygc"; + $this->name = "Opentheory"; + $this->uri = "http://open1theory.com"; + $this->description = "Returns the 5 newest posts from OpenTheory (full text)"; + $this->update = "02-08-2014"; - + } public function collectData(array $param){ diff --git a/bridges/PlanetLibreBridge.php b/bridges/PlanetLibreBridge.php index 5ada5358..6cb92e4d 100644 --- a/bridges/PlanetLibreBridge.php +++ b/bridges/PlanetLibreBridge.php @@ -1,15 +1,16 @@ maintainer = "pit-fgfjiudghdf"; + $this->name = "PlanetLibre"; + $this->uri = "http://www.planet-libre.org"; + $this->description = "Returns the 5 newest posts from PlanetLibre (full text)"; + $this->update = "2014-05-26"; + + } + public function collectData(array $param){ function PlanetLibreExtractContent($url) { diff --git a/bridges/ProjectMGameBridge.php b/bridges/ProjectMGameBridge.php index e8dc05cc..a3180416 100644 --- a/bridges/ProjectMGameBridge.php +++ b/bridges/ProjectMGameBridge.php @@ -1,13 +1,17 @@ maintainer = "corenting"; + $this->name = "Project M Game Bridge"; + $this->uri = "http://projectmgame.com/en/"; + $this->description = "Returns the newest articles."; + $this->update = "2014-08-27"; + + } + + public function collectData(array $param){ $html = ''; $html = file_get_html('http://projectmgame.com/en/') or $this->returnError('Error while downloading the Project M homepage', 404); diff --git a/bridges/TwitchApiBridge.php b/bridges/TwitchApiBridge.php index cedb7496..aec4a9c9 100644 --- a/bridges/TwitchApiBridge.php +++ b/bridges/TwitchApiBridge.php @@ -15,8 +15,8 @@ * Description for the API is available on GitHub: https://github.com/justintv/twitch-api */ -define(TWITCH_LIMIT, 10); // The default limit -define(TWITCH_BROADCASTS, 'false'); // The default flag for broadcasts +define('TWITCH_LIMIT', 10); // The default limit +define('TWITCH_BROADCASTS', 'false'); // The default flag for broadcasts class TwitchApiBridge extends BridgeAbstract{ From 43f0fc93b7f5f226d6f63b62659ac224ef6218fa Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 10:12:58 +0000 Subject: [PATCH 06/15] Correction of few bugs. Warn if RSS-Bridge cannot write to disk. Try/Catch the bridge RSS generation. Signed-off-by: teromene --- caches/FileCache.php | 10 ++++++++-- index.php | 30 ++++++++++++++++-------------- lib/Exceptions.php | 2 +- lib/RssBridge.php | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/caches/FileCache.php b/caches/FileCache.php index 594343d3..f2e0dbb7 100644 --- a/caches/FileCache.php +++ b/caches/FileCache.php @@ -24,7 +24,13 @@ class FileCache extends CacheAbstract{ public function saveData($datas){ $this->isPrepareCache(); - file_put_contents($this->getCacheFile(), json_encode($datas)); + $writeStream = file_put_contents($this->getCacheFile(), json_encode($datas)); + + if(!$writeStream) { + + throw new \Exception("Cannot write the cache... Do you have the right permissions ?"); + + } return $this; } @@ -89,4 +95,4 @@ class FileCache extends CacheAbstract{ $stringToEncode = $_SERVER['REQUEST_URI'] . http_build_query($this->param); return hash('sha1', $stringToEncode) . '.cache'; } -} \ No newline at end of file +} diff --git a/index.php b/index.php index 30dee333..3c3d6780 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,4 @@ setDatas($_REQUEST); $bridge->loadMetadatas(); // Data transformation - $format = Format::create($format); - $format - ->setDatas($bridge->getDatas()) - ->setExtraInfos(array( - 'name' => $bridge->getName(), - 'uri' => $bridge->getURI(), - )) - ->display(); + try { + $format = Format::create($format); + $format + ->setDatas($bridge->getDatas()) + ->setExtraInfos(array( + 'name' => $bridge->getName(), + 'uri' => $bridge->getURI(), + )) + ->display(); + } catch(Exception $e) { + + echo "The brige has crashed. You should report this to the bridges maintainer"; + + } die; } break; @@ -273,10 +278,7 @@ $formats = Format::searchInformation(); ?> - diff --git a/lib/Exceptions.php b/lib/Exceptions.php index 202060f6..74124eaa 100644 --- a/lib/Exceptions.php +++ b/lib/Exceptions.php @@ -58,4 +58,4 @@ class Http{ 508 => 'Loop detected', ); } -} \ No newline at end of file +} diff --git a/lib/RssBridge.php b/lib/RssBridge.php index d2952806..5e0824ff 100644 --- a/lib/RssBridge.php +++ b/lib/RssBridge.php @@ -39,4 +39,4 @@ require_once $vendorLibSimpleHtmlDom; )) ->display(); -*/ \ No newline at end of file +*/ From eaa8cf41738b2070a2a3015e8b3a71b4cdc0dc73 Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 11:20:11 +0000 Subject: [PATCH 07/15] 3rd batch of bridges. Signed-off-by: teromene --- bridges/RaymondBridge.php | 21 +++++++++++---------- bridges/Releases3DSBridge.php | 21 ++++++++++----------- bridges/ReporterreBridge.php | 22 +++++++++++----------- bridges/Rue89Bridge.php | 21 +++++++++++---------- bridges/ScilogsBridge.php | 22 +++++++++++----------- bridges/ScmbBridge.php | 20 ++++++++++---------- bridges/SegfaultMintBridge.php | 15 +++++++-------- bridges/Sexactu.php | 16 ++++++++++------ bridges/SiliconBridge.php | 21 ++++++++++----------- bridges/TheCodingLoveBridge.php | 18 ++++++++++-------- bridges/TheOatMealBridge.php | 22 +++++++++++++--------- bridges/TuxboardBridge.php | 18 ++++++++++-------- bridges/WikipediaDEBridge.php | 22 +++++++++++----------- bridges/WikipediaENBridge.php | 20 ++++++++++---------- bridges/WikipediaEOBridge.php | 20 ++++++++++---------- bridges/WikipediaFRBridge.php | 20 ++++++++++---------- bridges/ZatazBridge.php | 18 ++++++++++-------- 17 files changed, 175 insertions(+), 162 deletions(-) diff --git a/bridges/RaymondBridge.php b/bridges/RaymondBridge.php index 2d79ebb4..45e4b3df 100644 --- a/bridges/RaymondBridge.php +++ b/bridges/RaymondBridge.php @@ -1,15 +1,16 @@ maintainer = "pit-fgfjiudghdf"; + $this->name = "Raymond"; + $this->uri = "http://www.raymond.cc"; + $this->description = "Returns the 3 newest posts from Raymond.cc (full text)"; + $this->update = "2014-05-26"; + + } + public function collectData(array $param){ function raymondStripCDATA($string) { $string = str_replace('maintainer = "ORelio"; + $this->name = "3DS Scene Releases"; + $this->uri = "http://www.3dsdb.com/"; + $this->description = "Returns the newest scene releases."; + $this->update = "2015-09-17"; + + } + public function collectData(array $param) { function ExtractFromDelimiters($string, $start, $end) { diff --git a/bridges/ReporterreBridge.php b/bridges/ReporterreBridge.php index 3567edb8..7353722f 100644 --- a/bridges/ReporterreBridge.php +++ b/bridges/ReporterreBridge.php @@ -1,16 +1,16 @@ maintainer = "nyutag"; + $this->name = "Reporterre Bridge"; + $this->uri = "http://www.reporterre.net/"; + $this->description = "Returns the newest articles."; + $this->update = "2015-04-07"; + + } + public function collectData(array $param){ function ExtractContentReporterre($url) { diff --git a/bridges/Rue89Bridge.php b/bridges/Rue89Bridge.php index 0fe00338..cdd7780a 100644 --- a/bridges/Rue89Bridge.php +++ b/bridges/Rue89Bridge.php @@ -1,15 +1,16 @@ maintainer = "pit-fgfjiudghdf"; + $this->name = "Rue89"; + $this->uri = "http://rue89.nouvelobs.com/"; + $this->description = "Returns the 5 newest posts from Rue89 (full text)"; + $this->update = "2015-01-30"; + + } + public function collectData(array $param){ function Rue89StripCDATA($string) { $string = str_replace('maintainer = "qwertygc"; + $this->name = "Scilogs Bridge"; + $this->uri = "http://www.scilogs.fr/"; + $this->description = "Returns the newest articles."; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ function ScilogsStripCDATA($string) { diff --git a/bridges/ScmbBridge.php b/bridges/ScmbBridge.php index 4bad3747..dd2fa0dc 100644 --- a/bridges/ScmbBridge.php +++ b/bridges/ScmbBridge.php @@ -1,15 +1,15 @@ maintainer = "Astalaseven"; + $this->name = "Se Coucher Moins Bête Bridge"; + $this->uri = "http://secouchermoinsbete.fr/"; + $this->description = "Returns the newest anecdotes."; + $this->update = "2014-05-25"; + + } public function collectData(array $param){ $html = ''; diff --git a/bridges/SegfaultMintBridge.php b/bridges/SegfaultMintBridge.php index bb89c453..a2cbc20d 100644 --- a/bridges/SegfaultMintBridge.php +++ b/bridges/SegfaultMintBridge.php @@ -1,16 +1,15 @@ maintainer = "qwertygc"; + $this->name = "SegfaultMint"; + $this->uri = "http://segfault.linuxmint.com/"; + $this->description = "Returns the 5 newest posts from SegfaultMint (full text)"; + $this->update = "2014-07-05"; - + } public function collectData(array $param){ diff --git a/bridges/Sexactu.php b/bridges/Sexactu.php index edc173fe..c820f5ed 100644 --- a/bridges/Sexactu.php +++ b/bridges/Sexactu.php @@ -1,13 +1,17 @@ maintainer = "Riduidel"; + $this->name = "Sexactu"; + $this->uri = "http://www.gqmagazine.fr"; + $this->description = "Sexactu via rss-bridge"; + $this->update = "04/02/2014"; + + } + public function collectData(array $param){ $find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre'); $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); diff --git a/bridges/SiliconBridge.php b/bridges/SiliconBridge.php index ca712d24..27e0e91d 100644 --- a/bridges/SiliconBridge.php +++ b/bridges/SiliconBridge.php @@ -1,17 +1,16 @@ maintainer = "ORelio"; + $this->name = "Silicon.fr"; + $this->uri = "http://www.silicon.fr/"; + $this->description = "Returns the newest articles."; + $this->update = "2015-09-08"; + + } + public function collectData(array $param) { function StripCDATA($string) { diff --git a/bridges/TheCodingLoveBridge.php b/bridges/TheCodingLoveBridge.php index 387adec6..bd2fe857 100644 --- a/bridges/TheCodingLoveBridge.php +++ b/bridges/TheCodingLoveBridge.php @@ -1,14 +1,16 @@ maintainer = "superbaillot.net"; + $this->name = "The Coding Love"; + $this->uri = "http://thecodinglove.com/"; + $this->description = "The Coding Love"; + $this->update = "04/02/2015"; + + } + public function collectData(array $param){ $html = file_get_html('http://thecodinglove.com/') or $this->returnError('Could not request The Coding Love.', 404); diff --git a/bridges/TheOatMealBridge.php b/bridges/TheOatMealBridge.php index 7342ec2b..ba431c88 100644 --- a/bridges/TheOatMealBridge.php +++ b/bridges/TheOatMealBridge.php @@ -1,18 +1,22 @@ maintainer = "Riduidel"; + $this->name = "The Oatmeal"; + $this->uri = "http://theoatmeal.com/"; + $this->description = "Un petit site de dessins assez rigolos"; + $this->update = "2015-07-03"; + + } + public function collectData(array $param){ $param['url'] = THE_OATMEAL_RSS; parent::collectData($param); diff --git a/bridges/TuxboardBridge.php b/bridges/TuxboardBridge.php index f038fbd9..63f9d092 100644 --- a/bridges/TuxboardBridge.php +++ b/bridges/TuxboardBridge.php @@ -1,14 +1,16 @@ maintainer = "superbaillot.net"; + $this->name = "Tuxboard"; + $this->uri = "http://www.tuxboard.com/"; + $this->description = "Tuxboard"; + $this->update = "2014-07-08"; + + } + public function collectData(array $param){ function StripCDATA($string) { diff --git a/bridges/WikipediaDEBridge.php b/bridges/WikipediaDEBridge.php index 973170db..79b66fe7 100644 --- a/bridges/WikipediaDEBridge.php +++ b/bridges/WikipediaDEBridge.php @@ -1,21 +1,21 @@ maintainer = "cnlpete"; + $this->name = "Wikipedia DE Today's Featured Article..."; + $this->uri = "https://de.wikipedia.org/"; + $this->description = "Returns the highlighted en.wikipedia.org article."; + $this->update = "2015-11-04"; + + } + public function collectData(array $param){ $html = ''; $host = 'http://de.wikipedia.org'; // If you want HTTPS access instead, uncomment the following line: - //$host = 'https://en.wikipedia.org'; + //$host = 'https://de.wikipedia.org'; $link = '/wiki/Wikipedia:Hauptseite'; $html = file_get_html($host.$link) or $this->returnError('Could not request Wikipedia DE.', 404); diff --git a/bridges/WikipediaENBridge.php b/bridges/WikipediaENBridge.php index 128b170d..adf7b163 100644 --- a/bridges/WikipediaENBridge.php +++ b/bridges/WikipediaENBridge.php @@ -1,16 +1,16 @@ maintainer = "gsurrel"; + $this->name = "Wikipedia EN 'Today's Featured Article...'"; + $this->uri = "https://en.wikipedia.org/"; + $this->description = "Returns the highlighted en.wikipedia.org article."; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ $html = ''; $host = 'http://en.wikipedia.org'; diff --git a/bridges/WikipediaEOBridge.php b/bridges/WikipediaEOBridge.php index 1aa0681d..4f0d7ad7 100644 --- a/bridges/WikipediaEOBridge.php +++ b/bridges/WikipediaEOBridge.php @@ -1,16 +1,16 @@ maintainer = "gsurrel"; + $this->name = "Wikipedia EO 'Artikolo de la semajno'"; + $this->uri = "https://eo.wikipedia.org/"; + $this->description = "Returns the highlighted eo.wikipedia.org article."; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ $html = ''; $host = 'http://eo.wikipedia.org'; diff --git a/bridges/WikipediaFRBridge.php b/bridges/WikipediaFRBridge.php index e844cebf..741452a7 100644 --- a/bridges/WikipediaFRBridge.php +++ b/bridges/WikipediaFRBridge.php @@ -1,16 +1,16 @@ maintainer = "gsurrel"; + $this->name = "Wikipedia FR 'Lumière sur...'"; + $this->uri = "https://fr.wikipedia.org/"; + $this->description = "Returns the highlighted fr.wikipedia.org article."; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ $html = ''; $host = 'http://fr.wikipedia.org'; diff --git a/bridges/ZatazBridge.php b/bridges/ZatazBridge.php index b5affbcc..b52c4dd9 100644 --- a/bridges/ZatazBridge.php +++ b/bridges/ZatazBridge.php @@ -1,14 +1,16 @@ maintainer = "aledeg"; + $this->name = "Zataz"; + $this->uri = "http://www.zataz.com/"; + $this->description = "ZATAZ Magazine - S'informer, c'est déjà se sécuriser"; + $this->update = "07/02/2015"; + + } + public function collectData(array $param) { $html = file_get_html($this->getURI()) or $this->returnError('Could not request ' . $this->getURI(), 404); From ca2f6f425d722c9dfb48c8377b240b2e1939054e Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 13:28:32 +0000 Subject: [PATCH 08/15] =?UTF-8?q?Am=C3=A9lioration=20de=20la=20documentati?= =?UTF-8?q?on=20sur=20la=20cr=C3=A9ation=20de=20bridges.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: teromene --- CREATE_BRIDGE.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/CREATE_BRIDGE.md b/CREATE_BRIDGE.md index 215ae282..50333036 100644 --- a/CREATE_BRIDGE.md +++ b/CREATE_BRIDGE.md @@ -20,4 +20,73 @@ The RSS elements are stored in the class variable `items[]`. Every RSS element is an instance of the `Item` class. +##The `loadMetadatas` function +This function is the one used by rss-bridge core to determine the name, maintainer name, website, last updated date... of the bridge, and the user parameters. + +### Basic metadatas. + +The basic metadatas are the following : + +```PHP +$this->maintainer +$this->name +$this->uri +$this->description +$this->update +``` + +The default values are the following : + +```PHP +$this->name = "Unnamed bridge"; +$this->uri = ""; +$this->description = 'No description provided'; +$this->maintainer = 'No maintainer'; +``` + +### Parameters + +Parameters use a JSON-like format, which is parsed and transformed to HTML `` by rss-bridge. + +These datas goes into the `$this->parameters` array, which is not mandatory if your bridge doesn't take any parameter. + +Every possible usage of a bridge is an array element. + +The array can be a key-based array, but it is not necessary. The following syntaxes are hereby correct : + +```PHP +$this->parameters[] = ... +$this->parameters['First usage of my bridge'] = ... +``` + +### Format specifications + +Every `$this->parameters` element is a JSON array (`[ ... ]`) containing every input. + +It needs the following elements to be setted : +* name, the input name as displayed to the user +* identifier, which will be the key in the `$param` array for the corresponding data. + +Hence, the most basic parameter definition is the following: + +```PHP + $this->parameters = + '[ + { + "name" : "Username", + "identifier" : "u" + + } + ]'; +``` + +####Optional parameters + +Here is a list of optional parameters for the input : + +Parameter Name | Parameter values | Description +---------------|------------------|------------ +type|text, number, list, checkbox| Type of the input, default is text +required| true | Set this if you want your attribute to be required +values| [ {"name" : option1Name, "value" : "option1Value"}, ...] | Values list, required with the 'list' type From 2b543771488c9e60f06e8982a558e195d9148aea Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 15:49:55 +0000 Subject: [PATCH 09/15] Checking if the parameter mode has a name, same for exampleValue. Change the default bridge name. Signed-off-by: teromene --- index.php | 6 +++++- lib/Bridge.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 3c3d6780..01aa5388 100644 --- a/index.php +++ b/index.php @@ -185,7 +185,9 @@ CARD; foreach($bridgeElement->parameters as $parameterName => $parameter) { $card .= '
      ' . PHP_EOL; - $card .= '
      '.$parameterName.'
      ' . PHP_EOL; + if(!is_numeric($parameterName)) { + $card .= '
      '.$parameterName.'
      ' . PHP_EOL; + } $card .= ' ' . PHP_EOL; @@ -194,6 +196,8 @@ CARD; foreach($parameter as $inputEntry) { + if(!isset($inputEntry['exampleValue'])) $inputEntry['exampleValue'] = ""; + $idArg = 'arg-' . $bridgeName . '-' . $parameterName . '-' . $inputEntry['identifier']; $card .= '' . PHP_EOL; diff --git a/lib/Bridge.php b/lib/Bridge.php index b4945202..6ff1c389 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -17,7 +17,7 @@ abstract class BridgeAbstract implements BridgeInterface{ protected $cache; protected $items = array(); - public $name = "Bridge sans nom"; + public $name = "Unnamed bridge"; public $uri = ""; public $description = 'No description provided'; public $maintainer = 'No maintainer'; From 7268dbaae3f49ca50c37c857628f4102e51af280 Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 15:50:18 +0000 Subject: [PATCH 10/15] Last batch of bridges, all implemented ! Signed-off-by: teromene --- bridges/AllocineFRBridge.php | 20 ++-- bridges/AllocineT5Bridge.php | 20 ++-- bridges/AllocineTueursEnSerieBridge.php | 20 ++-- bridges/AnimeUltimeBridge.php | 39 +++++++ bridges/Arte7Bridge.php | 80 +++++++++++++-- bridges/BandcampBridge.php | 31 ++++-- bridges/BooruprojectBridge.php | 40 ++++++-- bridges/CNETBridge.php | 29 +++--- bridges/CpasbienBridge.php | 31 +++--- bridges/CryptomeBridge.php | 20 ++++ bridges/DailymotionBridge.php | 58 ++++++++--- bridges/DanbooruBridge.php | 33 ++++-- bridges/DauphineLibereBridge.php | 91 +++++++++++++++-- bridges/DollbooruBridge.php | 34 +++++-- bridges/DuckDuckGoBridge.php | 29 +++--- bridges/EZTVBridge.php | 32 +++--- bridges/FacebookBridge.php | 23 +++-- bridges/FlickrExploreBridge.php | 20 ++-- bridges/FlickrTagBridge.php | 37 ++++--- bridges/FourchanBridge.php | 28 +++-- bridges/Freenews.php | 25 +++-- bridges/Gawker.php | 27 +++-- bridges/GelbooruBridge.php | 34 +++++-- bridges/GiphyBridge.php | 39 ++++--- bridges/GooglePlusPostBridge.php | 30 +++--- bridges/GoogleSearchBridge.php | 30 ++++-- bridges/HDWallpapersBridge.php | 37 +++++-- bridges/IdenticaBridge.php | 30 ++++-- bridges/InstagramBridge.php | 33 +++--- bridges/KonachanBridge.php | 33 ++++-- bridges/LeBonCoinBridge.php | 130 ++++++++++++++++++++++++ bridges/LolibooruBridge.php | 34 +++++-- bridges/MilbooruBridge.php | 33 ++++-- bridges/MspabooruBridge.php | 23 +++++ bridges/OpenClassroomsBridge.php | 70 ++++++++++--- bridges/ParuVenduImmoBridge.php | 48 +++++++-- bridges/PickyWallpapersBridge.php | 43 ++++++-- bridges/PinterestBridge.php | 46 ++++++--- bridges/Rule34Bridge.php | 33 ++++-- bridges/Rule34pahealBridge.php | 34 +++++-- bridges/SafebooruBridge.php | 34 +++++-- bridges/SakugabooruBridge.php | 33 ++++-- bridges/ScoopItBridge.php | 30 +++--- bridges/SoundcloudBridge.php | 21 +++- bridges/SuperbWallpapersBridge.php | 41 ++++++-- bridges/T411Bridge.php | 29 ++++-- bridges/TagBoardBridge.php | 30 +++--- bridges/TbibBridge.php | 33 ++++-- bridges/ThePirateBayBridge.php | 31 +++--- bridges/TwitchApiBridge.php | 60 +++++++++++ bridges/TwitterBridge.php | 41 +++++--- bridges/TwitterBridgeClean.php | 41 +++++--- bridges/TwitterBridgeExtended.php | 38 ++++--- bridges/TwitterBridgeTweaked.php | 39 ++++--- bridges/UnsplashBridge.php | 41 ++++++-- bridges/WallpaperStopBridge.php | 45 ++++++-- bridges/WhydBridge.php | 34 ++++--- bridges/WordPressBridge.php | 35 ++++--- bridges/WorldOfTanks.php | 64 ++++++++++-- bridges/XbooruBridge.php | 33 ++++-- bridges/YandereBridge.php | 33 ++++-- 61 files changed, 1697 insertions(+), 616 deletions(-) diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php index 6bf5cce3..c95fcf71 100644 --- a/bridges/AllocineFRBridge.php +++ b/bridges/AllocineFRBridge.php @@ -1,17 +1,19 @@ maintainer = "superbaillot.net"; + $this->name = "Allo Cine : Faux Raccord"; + $this->uri = "http://www.allocine.fr/video/programme-12284/saison-24580/"; + $this->description = "Allo Cine : Faux Raccord"; + $this->update = "07/11/2013"; + + } + public function collectData(array $param){ $html = file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404); diff --git a/bridges/AllocineT5Bridge.php b/bridges/AllocineT5Bridge.php index f763428f..b52df289 100644 --- a/bridges/AllocineT5Bridge.php +++ b/bridges/AllocineT5Bridge.php @@ -1,17 +1,19 @@ maintainer = "superbaillot.net"; + $this->name = "Allo Cine : Top 5"; + $this->uri = "http://www.allocine.fr/video/programme-12299/saison-22542/"; + $this->description = "Allo Cine : Top 5 via rss-bridge"; + $this->update = "07/11/2013"; + + } + public function collectData(array $param){ $html = file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404); diff --git a/bridges/AllocineTueursEnSerieBridge.php b/bridges/AllocineTueursEnSerieBridge.php index 772c870f..4320c01b 100644 --- a/bridges/AllocineTueursEnSerieBridge.php +++ b/bridges/AllocineTueursEnSerieBridge.php @@ -1,17 +1,19 @@ maintainer = "superbaillot.net"; + $this->name = "Allo Cine : Tueurs En Serie"; + $this->uri = "http://www.allocine.fr/video/programme-12286/saison-22938/"; + $this->description = "Allo Cine : Tueurs En Serie"; + $this->update = "12/11/2013"; + + } + public function collectData(array $param){ $html = file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404); diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 9c89afea..97955de0 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -14,6 +14,45 @@ class AnimeUltimeBridge extends BridgeAbstract { private $filter = 'Releases'; + public function loadMetadatas() { + + $this->maintainer = "ORelio"; + $this->name = "Anime-Ultime"; + $this->uri = "http://www.anime-ultime.net/"; + $this->description = "Returns the 10 newest releases posted on Anime-Ultime"; + $this->update = "2015-10-30"; + + $this->parameters[] = + '[ + { + "name" : "Type", + "type" : "list", + "identifier" : "type", + "values" : [ + { + "name" : "everything", + "value" : "" + + }, + { + "name" : "Anime", + "value" : "A" + + }, + { + "name" : "Drama", + "value" : "D" + }, + { + "name" : "Tokusatsu", + "value" : "T" + + } + ] + } + ]'; + } + public function collectData(array $param) { //Add type filter if provided diff --git a/bridges/Arte7Bridge.php b/bridges/Arte7Bridge.php index fa4dbda8..005c94ef 100644 --- a/bridges/Arte7Bridge.php +++ b/bridges/Arte7Bridge.php @@ -1,15 +1,4 @@ toutes-les-videos;Actu & société=>actu-société;Séries & fiction=>séries-fiction;Cinéma=>cinéma;Arts & spectacles classiques=>arts-spectacles-classiques;Culture pop=>culture-pop;Découverte=>découverte;Histoire=>histoire;Junior=>junior") -* @use2(list|catde="Alle Videos (deutsch)=>alle-videos;Aktuelles & Gesellschaft=>aktuelles-gesellschaft;Fernsehfilme & Serien=>fernsehfilme-serien;Kino=>kino;Kunst & Kultur=>kunst-kultur;Popkultur & Alternativ=>popkultur-alternativ;Entdeckung=>entdeckung;Geschichte=>geschichte;Junior=>junior") -*/ class Arte7Bridge extends BridgeAbstract{ public function loadMetadatas() { @@ -41,6 +30,26 @@ class Arte7Bridge extends BridgeAbstract{ { "name" : "Cinéma", "value" : "cinéma" + }, + { + "name" : "Arts & spectacles classiques", + "value" : "arts-spectacles-classiques" + }, + { + "name" : "Culture pop", + "value" : "culture-pop" + }, + { + "name" : "Découverte", + "value" : "découverte" + }, + { + "name" : "Histoire", + "value" : "histoire" + }, + { + "name" : "Junior", + "value" : "junior" } ] @@ -49,6 +58,55 @@ class Arte7Bridge extends BridgeAbstract{ } ]'; + $this->parameters["Catégorie (Allemand)"] = + '[ + { + "type" : "list", + "identifier" : "catde", + "name" : "Catégorie", + "values" : [ + { + "name" : "Alle Videos (deutsch)", + "value" : "alle-videos" + }, + { + "name" : "Aktuelles & Gesellschaft", + "value" : "aktuelles-gesellschaft" + }, + { + "name" : "Fernsehfilme & Serien", + "value" : "fernsehfilme-serien" + }, + { + "name" : "Kino", + "value" : "kino" + }, + { + "name" : "Kunst & Kultur", + "value" : "kunst-kultur" + }, + { + "name" : "Popkultur & Alternativ", + "value" : "popkultur-alternativ" + }, + { + "name" : "Entdeckung", + "value" : "entdeckung" + }, + { + "name" : "Geschichte", + "value" : "geschichte" + }, + { + "name" : "Junior", + "value" : "junior" + } + ] + + + } + + ]'; } diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index 22f213e2..8d1d2aaf 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -1,18 +1,27 @@ maintainer = "sebsauvage"; + $this->name = "Bandcamp Tag"; + $this->uri = "http://bandcamp.com/"; + $this->description = "New bandcamp release by tag"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "tag", + "type" : "text", + "identifier" : "tag" + + } + ]'; + } + public function collectData(array $param){ $html = ''; if (isset($param['tag'])) { diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php index 980d8a83..7440cc2c 100644 --- a/bridges/BooruprojectBridge.php +++ b/bridges/BooruprojectBridge.php @@ -1,17 +1,35 @@ maintainer = "mitsukarenai"; + $this->name = "Booruproject"; + $this->uri = "http://booru.org/"; + $this->description = "Returns images from given page and booruproject instance (****.booru.org)"; + $this->update = "2015-09-12"; + + $this->parameters[] = + '[ + { + "name" : "instance (required)", + "required" : "true", + "identifier" : "i" + }, + { + "name" : "page", + "identifier" : "p" + }, + { + "name" : "tags", + "identifier" : "t" + } + + + ]'; + } + + public function collectData(array $param){ $page = 0; $tags = ''; if (!empty($param['p'])) { diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index 0450d1e8..28ada059 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -1,20 +1,25 @@ You may specify a topic, else all topics are selected. -* @maintainer ORelio -* @update 2015-09-10 -* @use1(topic="Topic name") -*/ class CNETBridge extends BridgeAbstract { private $topicName = ''; + public function loadMetadatas() { + + $this->maintainer = "ORelio"; + $this->name = "CNET News"; + $this->uri = "http://www.cnet.com/"; + $this->description = "Returns the newest articles.
      You may specify a topic, else all topics are selected."; + $this->update = "2015-09-10"; + + $this->parameters[] = + '[ + { + "name" : "Topic name", + "identifier" : "topic" + } + ]'; + } + public function collectData(array $param) { function ExtractFromDelimiters($string, $start, $end) { diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php index bd78cbd7..220da91e 100644 --- a/bridges/CpasbienBridge.php +++ b/bridges/CpasbienBridge.php @@ -1,16 +1,4 @@ maintainer = "lagaisse"; + $this->name = "Cpasbien Bridge"; + $this->uri = "http://Cpasbien.pw/"; + $this->description = "Returns latest torrent from request query"; + $this->update = "2015-05-17"; + + $this->parameters[] = + '[ + { + "name" : "keyword", + "identifier" : "q" + } + ]'; + + } + + public function collectData(array $param){ $html = ''; if (isset($param['q'])) { /* keyword search mode */ diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index 59b6dbd3..e12e0c34 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -13,6 +13,26 @@ */ class CryptomeBridge extends BridgeAbstract{ + public function loadMetadatas() { + + $this->maintainer = "BoboTiG"; + $this->name = "Cryptome"; + $this->uri = "http://cryptome.org/"; + $this->description = "Returns the N most recent documents."; + $this->update = ""; + + $this->parameters[] = + '[ + { + "name" : "number of elements", + "identifier" : "n", + "type" : "number", + "exampleValue" : "10" + } + ]'; + } + + public function collectData(array $param){ $html = ''; $num = 20; diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index 01202fe3..357f2eaa 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -1,22 +1,48 @@ maintainer = "mitsukarenai"; + $this->name = "Dailymotion Bridge"; + $this->uri = "https://www.dailymotion.com/"; + $this->description = "Returns the 5 newest videos by username/playlist or search"; + $this->update = "2014-11-18"; + + $this->parameters["By username"] = + '[ + { + "name" : "username", + "identifier" : "u" + } + ]'; + + $this->parameters["By playlist id"] = + '[ + { + "name" : "playlist id", + "identifier" : "p", + "type" : "number" + } + ]'; + + $this->parameters["From search results"] = + '[ + { + "name" : "Search keyword", + "identifier" : "s" + }, + { + "name" : "Page", + "identifier" : "pa", + "type" : "number" + } + ]'; + } + + public function collectData(array $param){ function getMetadata($id) { diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php index 5cdd4dcf..790b1983 100644 --- a/bridges/DanbooruBridge.php +++ b/bridges/DanbooruBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Danbooru"; + $this->uri = "http://donmai.us/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + + } + public function collectData(array $param){ $page = 1;$tags=''; if (isset($param['p'])) { diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 9ce39ae2..3721876e 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -1,13 +1,88 @@ ;France Monde=>france-monde;Faits Divers=>faits-divers;Économie et Finance =>economie-et-finance;Politique=>politique;Sport=>sport;Ain=>ain;Alpes-de-Haute-Provence=>haute-provence;Hautes-Alpes=>hautes-alpes;Ardèche=>ardeche;Drôme=>drome;Isère Sud=>isere-sud;Isère Nord=>isere-nord;Savoie=>savoie;Haute-Savoie=>haute-savoie;Vaucluse=>vaucluse") -*/ class DauphineLibereBridge extends BridgeAbstract{ - + + public function loadMetadatas() { + + $this->maintainer = "qwertygc"; + $this->name = "DauphineLibereBridge Bridge"; + $this->uri = "http://www.ledauphine.com/"; + $this->description = "Returns the newest articles."; + $this->update = "05/11/2015"; + + + $this->parameters[] = + '[ + { + "name" : "Catégorie de l\'article", + "identifier" : "u", + "type" : "list", + "values" : [ + { + "name" : "À la une", + "value" : "" + }, + { + "name" : "France Monde", + "value" : "france-monde" + }, + { + "name" : "Faits Divers", + "value" : "faits-divers" + }, + { + "name" : "Économie et Finance", + "value" : "economie-et-finance" + }, + { + "name" : "Politique", + "value" : "politique" + }, + { + "name" : "Sport", + "value" : "sport" + }, + { + "name" : "Ain", + "value" : "ain" + }, + { + "name" : "Alpes-de-Haute-Provence", + "value" : "haute-provence" + }, + { + "name" : "Hautes-Alpes", + "value" : "hautes-alpes" + }, + { + "name" : "Ardèche", + "value" : "ardeche" + }, + { + "name" : "Drôme", + "value" : "drome" + }, + { + "name" : "Isère Sud", + "value" : "isere-sud" + }, + { + "name" : "Savoie", + "value" : "savoie" + }, + { + "name" : "Haute-Savoie", + "value" : "haute-savoie" + }, + { + "name" : "Vaucluse", + "value" : "vaucluse" + } + ] + } + ]'; + } + + public function collectData(array $param){ diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php index 631396e8..637fa488 100644 --- a/bridges/DollbooruBridge.php +++ b/bridges/DollbooruBridge.php @@ -1,17 +1,29 @@ maintainer = "mitsukarenai"; + $this->name = "Dollbooru"; + $this->uri = "http://dollbooru.org/"; + $this->description = "Returns images from given page"; + $this->update = "2015-01-20"; + + + $this->parameters[] = + '[ + { + "name" : "page", + "type" : "number", + "identifier" : "p" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/DuckDuckGoBridge.php b/bridges/DuckDuckGoBridge.php index 40c86c6c..f0e5b9ae 100644 --- a/bridges/DuckDuckGoBridge.php +++ b/bridges/DuckDuckGoBridge.php @@ -1,18 +1,23 @@ maintainer = "Astalaseven"; + $this->name = "DuckDuckGo"; + $this->uri = "https://duckduckgo.com/"; + $this->description = "Returns most recent results from DuckDuckGo."; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "keyword", + "identifier" : "u" + } + ]'; + } + public function collectData(array $param){ $html = ''; $link = 'http://duckduckgo.com/html/?q='.$param[u].'+sort:date'; diff --git a/bridges/EZTVBridge.php b/bridges/EZTVBridge.php index 3f66ea40..c58348a0 100644 --- a/bridges/EZTVBridge.php +++ b/bridges/EZTVBridge.php @@ -1,19 +1,25 @@ maintainer = "alexAubin"; + $this->name = "EZTV"; + $this->uri = "https://eztv.ch/"; + $this->description = "Returns list of *recent* torrents for a specific show on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name."; + $this->update = "2014-01-20"; + + $this->parameters[] = + '[ + { + "name" : "Show ids", + "identifier" : "i", + "exampleValue" : "showID1,showID2,..." + } + ]'; + + } + public function collectData(array $param){ // Make timestamp from relative released time in table diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index dc37d5ec..98e7e8b6 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -1,15 +1,22 @@ maintainer = "teromene"; + $this->name = "Facebook"; + $this->uri = "http://facebook.com/"; + $this->description = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117"; + $this->update = "23/10/2015"; + + $this->parameters[] = + '[ + { + "name" : "Username", + "identifier" : "u" + } + ]'; + } public function collectData(array $param){ diff --git a/bridges/FlickrExploreBridge.php b/bridges/FlickrExploreBridge.php index f5ad292c..c39c4899 100644 --- a/bridges/FlickrExploreBridge.php +++ b/bridges/FlickrExploreBridge.php @@ -1,16 +1,16 @@ maintainer = "sebsauvage"; + $this->name = "Flickr Explore"; + $this->uri = "http://www.flickr.com/explore"; + $this->description = "Returns the latest interesting images from Flickr"; + $this->update = "2014-05-25"; + + } + public function collectData(array $param){ $html = file_get_html('http://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404); diff --git a/bridges/FlickrTagBridge.php b/bridges/FlickrTagBridge.php index fa274b15..19977530 100644 --- a/bridges/FlickrTagBridge.php +++ b/bridges/FlickrTagBridge.php @@ -1,18 +1,31 @@ maintainer = "erwang"; + $this->name = "Flickr TagUser"; + $this->uri = "http://www.flickr.com/"; + $this->description = "Returns the tagged or user images from Flickr"; + $this->update = "2014-05-26"; + + $this->parameters["By keyword"] = + '[ + { + "name" : "Keyword", + "identifier" : "q" + } + ]'; + + $this->parameters["By username"] = + '[ + { + "name" : "Username", + "identifier" : "u" + } + ]'; + } + public function collectData(array $param){ $html = file_get_html('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnError('Could not request Flickr.', 404); if (isset($param['q'])) { /* keyword search mode */ diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index d67b68b6..70f0477d 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -1,16 +1,24 @@ maintainer = "mitsukarenai"; + $this->name = "4chan"; + $this->uri = "https://www.4chan.org/"; + $this->description = "Returns posts from the specified thread"; + $this->update = "2015-02-01"; + + $this->parameters[] = + '[ + { + "name" : "Thread URL", + "identifier" : "t" + } + ]'; + } + + public function collectData(array $param){ if (!isset($param['t'])) diff --git a/bridges/Freenews.php b/bridges/Freenews.php index 65c03298..e1cf094c 100644 --- a/bridges/Freenews.php +++ b/bridges/Freenews.php @@ -1,14 +1,25 @@ maintainer = "mitsukarenai"; + $this->name = "Freenews"; + $this->uri = "http://freenews.fr"; + $this->description = "Un site d'actualité pour les freenautes (mais ne parlant pas que de la freebox). Ne rentrez pas d'id si vous voulez accéder aux actualités générales."; + $this->update = "26/03/2014"; + + $this->parameters[] = + '[ + { + "name" : "Id de la rubrique (sans le \'-\')", + "identifier" : "id" + } + ]'; + } + public function collectData(array $param){ $param['url'] = RSS; parent::collectData($param); diff --git a/bridges/Gawker.php b/bridges/Gawker.php index f8b484ff..08a42f5f 100644 --- a/bridges/Gawker.php +++ b/bridges/Gawker.php @@ -1,16 +1,27 @@ maintainer = "mitsukarenai"; + $this->name = "Gawker media"; + $this->uri = "http://feeds.gawker.com/"; + $this->description = "A bridge allowing access to any of the numerous Gawker media blogs (Lifehacker, deadspin, Kotaku, Jezebel, and so on. Notice you have to give its id to find the RSS stream in gawker maze"; + $this->update = "27/03/2014"; + + $this->parameters[] = + '[ + { + "name" : "site id to put in uri between feeds.gawker.com and /full .. which is obviously not full AT ALL", + "identifier" : "site" + } + ]'; + } + + private function toURI($name) { return RSS_PREFIX.$name.RSS_SUFFIX; } diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php index 86d77a70..3747c40b 100644 --- a/bridges/GelbooruBridge.php +++ b/bridges/GelbooruBridge.php @@ -1,17 +1,29 @@ maintainer = "mitsukarenai"; + $this->name = "Gelbooru"; + $this->uri = "http://gelbooru.com/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + + } + public function collectData(array $param){ $page = 0; if (isset($param['p'])) { diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php index f3c0d99b..69442f6e 100644 --- a/bridges/GiphyBridge.php +++ b/bridges/GiphyBridge.php @@ -1,21 +1,34 @@ maintainer = "kraoc"; + $this->name = "Giphy Bridge"; + $this->uri = "http://giphy.com/"; + $this->description = "Bridge for giphy.com"; + $this->update = "2014-12-05"; + + $this->parameters["By tag"] = + '[ + { + "name" : "search tag", + "identifier" : "s" + } + ]'; + + $this->parameters["Without tag"] = + '[ + { + "name" : "max number of returned items", + "type" : "number", + "identifier" : "n" + } + ]'; + } + public function collectData(array $param){ $html = ''; $base_url = 'http://giphy.com'; diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index ab77deea..16b3f100 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -1,21 +1,27 @@ maintainer = "Grummfy"; + $this->name = "Google Plus Post Bridge"; + $this->uri = "http://plus.google.com/"; + $this->description = "Returns user public post (without API)."; + $this->update = "2014-07-20"; + + $this->parameters[] = + '[ + { + "name" : "username or Id", + "identifier" : "username" + } + ]'; + + } + const GOOGLE_PLUS_BASE_URL = 'https://plus.google.com/'; public function collectData(array $param) diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index 464b902d..a76b26db 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -1,25 +1,35 @@ maintainer = "sebsauvage"; + $this->name = "Google search"; + $this->uri = "https://www.google.com/"; + $this->description = "Returns most recent results from Google search."; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "keyword", + "identifier" : "q" + } + ]'; + + } + + public function collectData(array $param){ $html = ''; diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php index befdaccc..0fc9aaaf 100644 --- a/bridges/HDWallpapersBridge.php +++ b/bridges/HDWallpapersBridge.php @@ -1,20 +1,35 @@ maintainer = "nel50n"; + $this->name = "HD Wallpapers Bridge"; + $this->uri = "http://www.hdwallpapers.in/"; + $this->description = "Returns the latests wallpapers from HDWallpapers"; + $this->update = "2015-04-08"; + + $this->parameters[] = + '[ + { + "name" : "category", + "identifier" : "c" + }, + { + "name" : "max number of wallpapers", + "identifier" : "m" + }, + { + "name" : "resolution", + "identifier" : "r", + "exampleValue" : "1920x1200, 1680x1050, ..." + } + ]'; + } + public function collectData(array $param){ $html = ''; $baseUri = 'http://www.hdwallpapers.in'; diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php index 60ab788d..c5562ee1 100644 --- a/bridges/IdenticaBridge.php +++ b/bridges/IdenticaBridge.php @@ -1,18 +1,26 @@ maintainer = "mitsukarenai"; + $this->name = "Identica Bridge"; + $this->uri = "https://identi.ca/"; + $this->description = "Returns user timelines"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "username", + "identifier" : "u" + } + ]'; + + } + public function collectData(array $param){ $html = ''; if (isset($param['u'])) { /* user timeline mode */ diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index 93e1a183..a137eee6 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -1,19 +1,26 @@ maintainer = "pauder"; + $this->name = "Instagram Bridge"; + $this->uri = "http://instagram.com/"; + $this->description = "Returns the newest images"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "username", + "identifier" : "u" + } + ]'; + + } + public function collectData(array $param){ $html = ''; if (isset($param['u'])) { /* user timeline mode */ diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php index b4df4076..7c4e8623 100644 --- a/bridges/KonachanBridge.php +++ b/bridges/KonachanBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Konachan"; + $this->uri = "http://konachan.com/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 1;$tags=''; if (isset($param['p'])) { diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php index 3a1df702..1563b654 100755 --- a/bridges/LeBonCoinBridge.php +++ b/bridges/LeBonCoinBridge.php @@ -14,6 +14,136 @@ class LeBonCoinBridge extends BridgeAbstract{ + public function loadMetadatas() { + + $this->maintainer = "16mhz"; + $this->name = "LeBonCoin"; + $this->uri = "http://www.leboncoin.fr"; + $this->description = "Returns most recent results from LeBonCoin for a region and a keyword."; + $this->update = "2015-10-30"; + + $this->parameters[] = + '[ + { + "name" : "Keyword", + "identifier" : "k" + }, + { + "name" : "Région", + "identifier" : "r", + "type" : "list", + "values" : [ + { + "name" : "Alsace", + "value" : "alsace" + }, + { + "name" : "Aquitaine", + "value" : "aquitaine" + }, + { + "name" : "Auvergne", + "value" : "auvergne" + }, + { + "name" : "Basse Normandie", + "value" : "basse_normandie" + }, + { + "name" : "Bourgogne", + "value" : "bourgogne" + }, + { + "name" : "Bretagne", + "value" : "bretagne" + }, + { + "name" : "Centre", + "value" : "centre" + }, + { + "name" : "Champagne Ardenne", + "value" : "champagne_ardenne" + }, + { + "name" : "Corse", + "value" : "corse" + }, + { + "name" : "Franche Comté", + "value" : "franche_comte" + }, + { + "name" : "Haute Normandie", + "value" : "haute_normandie" + }, + { + "name" : "Ile de France", + "value" : "ile_de_france" + }, + { + "name" : "Languedoc Roussillon", + "value" : "languedoc_roussillon" + }, + { + "name" : "Limousin", + "value" : "limousin" + }, + { + "name" : "Lorraine", + "value" : "lorraine" + }, + { + "name" : "Midi Pyrénées", + "value" : "midi_pyrenees" + }, + { + "name" : "Nord Pas De Calais", + "value" : "nord_pas_de_calais" + }, + { + "name" : "Pays de la Loire", + "value" : "pays_de_la_loire" + }, + { + "name" : "Picardie", + "value" : "picardie" + }, + { + "name" : "Poitou Charentes", + "value" : "poitou_charentes" + }, + { + "name" : "Provence Alpes Côte d\'Azur", + "value" : "provence_alpes_cote_d_azur" + }, + { + "name" : "Rhône-Alpes", + "value" : "rhone_alpes" + }, + { + "name" : "Guadeloupe", + "value" : "guadeloupe" + }, + { + "name" : "Martinique", + "value" : "martinique" + }, + { + "name" : "Guyane", + "value" : "guyane" + }, + { + "name" : "Réunion", + "value" : "reunion" + } + ] + } + ]'; + + } + + public function collectData(array $param){ $html = ''; diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php index 54111312..38fe4757 100644 --- a/bridges/LolibooruBridge.php +++ b/bridges/LolibooruBridge.php @@ -1,17 +1,29 @@ maintainer = "mitsukarenai"; + $this->name = "Lolibooru"; + $this->uri = "http://lolibooru.moe/"; + $this->description = "Returns images from given page and tags"; + $this->update = "2015-03-21"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + + } + public function collectData(array $param){ $page = 1; $tags = ''; if (isset($param['p'])) { diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php index 9059fa79..cc8e9da3 100644 --- a/bridges/MilbooruBridge.php +++ b/bridges/MilbooruBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Milbooru"; + $this->uri = "http://sheslostcontrol.net/moe/shimmie/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php index b3d3b61a..f949026c 100644 --- a/bridges/MspabooruBridge.php +++ b/bridges/MspabooruBridge.php @@ -12,6 +12,29 @@ */ class MspabooruBridge extends BridgeAbstract{ + public function loadMetadatas() { + + $this->maintainer = "mitsukarenai"; + $this->name = "Mspabooru"; + $this->uri = "http://mspabooru.com/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/OpenClassroomsBridge.php b/bridges/OpenClassroomsBridge.php index 0c8eda71..c3ae019d 100644 --- a/bridges/OpenClassroomsBridge.php +++ b/bridges/OpenClassroomsBridge.php @@ -1,18 +1,64 @@ arts;Code=>code;Design=>design;Entreprise=>business;Numérique=>digital;Sciences=>sciences;Sciences humaines=>humanities;Systèmes d'information=>it;Autres=>others") -*/ class OpenClassroomsBridge extends BridgeAbstract{ + public function loadMetadatas() { + + $this->maintainer = "sebsauvage"; + $this->name = "OpenClassrooms Bridge"; + $this->uri = "https://openclassrooms.com/"; + $this->description = "Returns latest tutorials from OpenClassrooms."; + $this->update = "2015-10-30"; + + + $this->parameters[] = + '[ + { + "name" : "Catégorie", + "identifier" : "u", + "type" : "list", + "values" : [ + { + "name" : "Arts & Culture", + "value" : "arts" + }, + { + "name" : "Code", + "value" : "code" + }, + { + "name" : "Design", + "value" : "design" + }, + { + "name" : "Entreprise", + "value" : "business" + }, + { + "name" : "Numérique", + "value" : "digital" + }, + { + "name" : "Sciences", + "value" : "sciences" + }, + { + "name" : "Sciences Humaines", + "value" : "humainities" + }, + { + "name" : "Systèmes d\'information", + "value" : "it" + }, + { + "name" : "Autres", + "value" : "others" + } + ] + } + ]'; + } + + public function collectData(array $param){ if (empty($param['u'])) { diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php index e1453507..a9c38ea4 100644 --- a/bridges/ParuVenduImmoBridge.php +++ b/bridges/ParuVenduImmoBridge.php @@ -1,19 +1,45 @@ maintainer = "polo2ro"; + $this->name = "Paru Vendu Immobilier"; + $this->uri = "http://www.paruvendu.fr/immobilier/"; + $this->description = "Returns the ads from the first page of search result."; + $this->update = "2015-02-02"; + + + $this->parameters[] = + '[ + { + "name": "Minimal surface m²", + "type" : "number", + "identifier" : "minarea" + }, + { + "name" : "Max price", + "type" : "number", + "identifier" : "maxprice" + }, + { + "name" : "Country code", + "type" : "text", + "identifier" : "pa", + "exampleValue" : "FR" + }, + { + "name" : "department numbers or postal codes, comma-separated", + "type" : "text", + "identifier" : "lo" + } + + ]'; + } + public function collectData(array $param) { $html = ''; diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index 1f47a5c9..87cfb166 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -1,21 +1,42 @@ maintainer = "nel50n"; + $this->name = "PickyWallpapers Bridge"; + $this->uri = "http://www.pickywallpapers.com/"; + $this->description = "Returns the latests wallpapers from PickyWallpapers"; + $this->update = "2014-03-31"; + + $this->parameters[] = + '[ + { + "name" : "Category", + "identifier" : "c" + }, + { + "name" : "subcategory", + "identifier" : "s" + }, + { + "name" : "Max number of wallpapers", + "identifier" : "m", + "type" : "number" + }, + { + "name" : "resolution", + "identifier" : "r", + "exampleValue" : "1920x1200, 1680x1050, ..." + } + + ]'; + } + public function collectData(array $param){ $html = ''; if (!isset($param['c'])) { diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 0f23bb6a..3bb0530c 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -1,22 +1,40 @@ maintainer = "pauder"; + $this->name = "Pinterest Bridge"; + $this->uri = "http://www.pinterest.com/"; + $this->description = "Returns the newest images on a board"; + $this->update = "2014-05-25"; + + $this->parameters["By username and board"] = + '[ + { + "name" : "username", + "identifier" : "u" + }, + { + "name" : "board", + "identifier" : "b" + + } + ]'; + + $this->parameters["From search"] = + '[ + { + "name" : "Keyword", + "identifier" : "q" + } + ]'; + } + public function collectData(array $param){ $html = ''; if (isset($param['u']) || isset($param['b'])) { diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php index f7f05f03..cda601d7 100644 --- a/bridges/Rule34Bridge.php +++ b/bridges/Rule34Bridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Rule34"; + $this->uri = "http://rule34.xxx/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php index 5bfe9200..3ecab159 100644 --- a/bridges/Rule34pahealBridge.php +++ b/bridges/Rule34pahealBridge.php @@ -1,17 +1,29 @@ maintainer = "mitsukarenai"; + $this->name = "Rule34paheal"; + $this->uri = "http://rule34.paheal.net/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php index d33b0d7d..07d702d9 100644 --- a/bridges/SafebooruBridge.php +++ b/bridges/SafebooruBridge.php @@ -1,17 +1,29 @@ maintainer = "mitsukarenai"; + $this->name = "Safebooru"; + $this->uri = "http://safebooru.org/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php index 860be578..0a99b431 100644 --- a/bridges/SakugabooruBridge.php +++ b/bridges/SakugabooruBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Sakugabooru"; + $this->uri = "http://sakuga.yshi.org/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 1;$tags=''; if (isset($param['p'])) { diff --git a/bridges/ScoopItBridge.php b/bridges/ScoopItBridge.php index d8d7127f..65511a44 100644 --- a/bridges/ScoopItBridge.php +++ b/bridges/ScoopItBridge.php @@ -1,18 +1,24 @@ maintainer = "Pitchoule"; + $this->name = "ScoopIt"; + $this->uri = "http://www.scoop.it"; + $this->description = "Returns most recent results from ScoopIt."; + $this->update = "2014-06-13"; + + $this->parameters[] = + '[ + { + "name" : "keyword", + "identifier" : "u" + } + ]'; + + } + public function collectData(array $param){ $html = ''; if ($param['u'] != '') { diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 7bcc6d0a..2b19b232 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -15,7 +15,26 @@ class SoundCloudBridge extends BridgeAbstract{ private $request; public $name; - const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875'; + + public function loadMetadatas() { + + $this->maintainer = "kranack"; + $this->name = "Soundcloud Bridge"; + $this->uri = "http://www.soundcloud.com/"; + $this->description = "Returns 10 newest music from user profile"; + $this->update = "2015-09-08"; + + $this->parameters[] = + '[ + { + "name" : "username", + "identifier" : "u" + } + ]'; + + } + + const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875'; public function collectData(array $param){ diff --git a/bridges/SuperbWallpapersBridge.php b/bridges/SuperbWallpapersBridge.php index c437d924..c996d790 100644 --- a/bridges/SuperbWallpapersBridge.php +++ b/bridges/SuperbWallpapersBridge.php @@ -1,20 +1,39 @@ maintainer = "nel50n"; + $this->name = "Superb Wallpapers Bridge"; + $this->uri = "http://www.superbwallpapers.com/"; + $this->description = "Returns the latests wallpapers from SuperbWallpapers"; + $this->update = "2015-04-08"; + + $this->parameters[] = + '[ + { + "name" : "Category", + "identifier" : "c" + }, + { + "name" : "Max number of wallpapers", + "identifier" : "m", + "type" : "number" + }, + { + "name" : "resolution", + "identifier" : "r", + "exampleValue" : "1920x1200, 1680x1050, ..." + } + + ]'; + + } + + public function collectData(array $param){ $html = ''; $baseUri = 'http://www.superbwallpapers.com'; diff --git a/bridges/T411Bridge.php b/bridges/T411Bridge.php index 8571bb08..db92a96b 100644 --- a/bridges/T411Bridge.php +++ b/bridges/T411Bridge.php @@ -1,17 +1,24 @@ Use url part after '?' mark when using their search engine - * @maintainer ORelio - * @update 2015-10-22 - * @use1(search="search criteria") - */ class T411Bridge extends BridgeAbstract { + public function loadMetadatas() { + + $this->maintainer = "ORelio"; + $this->name = "T411"; + $this->uri = "https://t411.in/"; + $this->description = "Returns the 5 newest torrents with specified search terms
      Use url part after '?' mark when using their search engine"; + $this->update = "2015-10-22"; + + $this->parameters[] = + '[ + { + "name" : "Search criteria", + "identifier" : "search" + } + ]'; + } + + public function collectData(array $param) { //Utility function for extracting CDATA fields diff --git a/bridges/TagBoardBridge.php b/bridges/TagBoardBridge.php index 2b9abcee..0a740b1c 100644 --- a/bridges/TagBoardBridge.php +++ b/bridges/TagBoardBridge.php @@ -1,18 +1,24 @@ maintainer = "Pitchoule"; + $this->name = "TagBoard"; + $this->uri = "http://www.TagBoard.com"; + $this->description = "Returns most recent results from TagBoard."; + $this->update = "2014-09-10"; + + $this->parameters[] = + '[ + { + "name" : "keyword", + "identifier" : "u" + } + ]'; + + } + public function collectData(array $param){ $html = ''; $this->request = $param['u']; diff --git a/bridges/TbibBridge.php b/bridges/TbibBridge.php index 48718591..cca0b0b0 100644 --- a/bridges/TbibBridge.php +++ b/bridges/TbibBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Tbib"; + $this->uri = "http://tbib.org/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/ThePirateBayBridge.php b/bridges/ThePirateBayBridge.php index 12171ecd..adb36419 100644 --- a/bridges/ThePirateBayBridge.php +++ b/bridges/ThePirateBayBridge.php @@ -1,19 +1,24 @@ maintainer = "mitsukarenai"; + $this->name = "The Pirate Bay"; + $this->uri = "https://thepiratebay.vg/"; + $this->description = "Returns results for the keywords. You can put several list of keywords by separating them with a semicolon (e.g. \"one show;another show\")"; + $this->update = "2014-05-26"; + + $this->parameters[] = + '[ + { + "name" : "keywords, separated by semicolons", + "identifier" : "q", + "exampleValue" : "first list;second list;..." + } + ]'; + } + public function collectData(array $param){ function parseDateTimestamp($element){ diff --git a/bridges/TwitchApiBridge.php b/bridges/TwitchApiBridge.php index aec4a9c9..25a08b14 100644 --- a/bridges/TwitchApiBridge.php +++ b/bridges/TwitchApiBridge.php @@ -22,6 +22,66 @@ class TwitchApiBridge extends BridgeAbstract{ // for use in the getName function! private $channel; + + public function loadMetadatas() { + + $this->maintainer = "logmanoriginal"; + $this->name = "Twitch API Bridge"; + $this->uri = "http://www.twitch.tv"; + $this->description = "Returns the newest broadcasts or highlights by channel name using the Twitch API (v3)"; + $this->update = "2015-07-14"; + + $this->parameters["Get channel without limit"] = + '[ + { + "name" : "Channel", + "identifier" : "channel" + }, + { + "name" : "Broadcasts", + "identifier" : "broadcasts", + "type" : "list", + "values" : [ + { + "name" : "Show broadcasts", + "value" : "true" + }, + { + "name" : "Don\'t show broadcasts", + "value" : "false" + } + ] + } + ]'; + $this->parameters["Get channel with limit"] = + '[ + { + "name" : "Channel", + "identifier" : "channel" + }, + { + "name" : "Limit", + "identifier" : "limit", + "type" : "number" + }, + { + "name" : "Broadcasts", + "identifier" : "broadcasts", + "type" : "list", + "values" : [ + { + "name" : "Show broadcasts", + "value" : "true" + }, + { + "name" : "Don\'t show broadcasts", + "value" : "false" + } + ] + } + ]'; + + } public function collectData(array $param){ diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 91101e39..be007e82 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -1,20 +1,35 @@ maintainer = "mitsukarenai"; + $this->name = "Twitter Bridge"; + $this->uri = "http://twitter.com/"; + $this->description = "Returns user timelines or keyword/hashtag search results (without using their API)."; + $this->update = "2014-05-25"; + + $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 */ diff --git a/bridges/TwitterBridgeClean.php b/bridges/TwitterBridgeClean.php index 0db6a48e..f804556c 100644 --- a/bridges/TwitterBridgeClean.php +++ b/bridges/TwitterBridgeClean.php @@ -1,20 +1,35 @@ maintainer = "vinzv"; + $this->name = "Twitter Bridge Clean"; + $this->uri = "http://twitter.com/"; + $this->description = "Returns user timelines without username in title or search results for keywords/hashtags (without using their API)."; + $this->update = "2015-03-07"; + + $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 */ diff --git a/bridges/TwitterBridgeExtended.php b/bridges/TwitterBridgeExtended.php index d1176355..c87d414c 100644 --- a/bridges/TwitterBridgeExtended.php +++ b/bridges/TwitterBridgeExtended.php @@ -1,18 +1,32 @@ maintainer = "mitsukarenai"; + $this->name = "Twitter Bridge Extended"; + $this->uri = "https://twitter.com/"; + $this->description = "(same as Twitter Bridge, but with avatar, replies and RTs)"; + $this->update = "2014-05-25"; + + $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 */ diff --git a/bridges/TwitterBridgeTweaked.php b/bridges/TwitterBridgeTweaked.php index 92825d12..d91a6043 100644 --- a/bridges/TwitterBridgeTweaked.php +++ b/bridges/TwitterBridgeTweaked.php @@ -1,19 +1,32 @@ maintainer = "kraoc"; + $this->name = "Twitter Bridge Tweaked"; + $this->uri = "https://twitter.com/"; + $this->description = "(same as Twitter Bridge Extended, but with cleaned title & content)"; + $this->update = "2014-12-05"; + + $this->parameters["By keyword or hashtag"] = + '[ + { + "name" : "Keyword or #hashtag", + "identifier" : "q" + } + ]'; + + $this->parameters["By username"] = + '[ + { + "name" : "username", + "identifier" : "u" + } + ]'; + + } + private function containsTLD($string) { preg_match( "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($|\/)|\.AQ($|\/)|\.AR($|\/)|\.ARPA($|\/)|\.AS($|\/)|\.ASIA($|\/)|\.AT($|\/)|\.AU($|\/)|\.AW($|\/)|\.AX($|\/)|\.AZ($|\/)|\.BA($|\/)|\.BB($|\/)|\.BD($|\/)|\.BE($|\/)|\.BF($|\/)|\.BG($|\/)|\.BH($|\/)|\.BI($|\/)|\.BIZ($|\/)|\.BJ($|\/)|\.BM($|\/)|\.BN($|\/)|\.BO($|\/)|\.BR($|\/)|\.BS($|\/)|\.BT($|\/)|\.BV($|\/)|\.BW($|\/)|\.BY($|\/)|\.BZ($|\/)|\.CA($|\/)|\.CAT($|\/)|\.CC($|\/)|\.CD($|\/)|\.CF($|\/)|\.CG($|\/)|\.CH($|\/)|\.CI($|\/)|\.CK($|\/)|\.CL($|\/)|\.CM($|\/)|\.CN($|\/)|\.CO($|\/)|\.COM($|\/)|\.COOP($|\/)|\.CR($|\/)|\.CU($|\/)|\.CV($|\/)|\.CX($|\/)|\.CY($|\/)|\.CZ($|\/)|\.DE($|\/)|\.DJ($|\/)|\.DK($|\/)|\.DM($|\/)|\.DO($|\/)|\.DZ($|\/)|\.EC($|\/)|\.EDU($|\/)|\.EE($|\/)|\.EG($|\/)|\.ER($|\/)|\.ES($|\/)|\.ET($|\/)|\.EU($|\/)|\.FI($|\/)|\.FJ($|\/)|\.FK($|\/)|\.FM($|\/)|\.FO($|\/)|\.FR($|\/)|\.GA($|\/)|\.GB($|\/)|\.GD($|\/)|\.GE($|\/)|\.GF($|\/)|\.GG($|\/)|\.GH($|\/)|\.GI($|\/)|\.GL($|\/)|\.GM($|\/)|\.GN($|\/)|\.GOV($|\/)|\.GP($|\/)|\.GQ($|\/)|\.GR($|\/)|\.GS($|\/)|\.GT($|\/)|\.GU($|\/)|\.GW($|\/)|\.GY($|\/)|\.HK($|\/)|\.HM($|\/)|\.HN($|\/)|\.HR($|\/)|\.HT($|\/)|\.HU($|\/)|\.ID($|\/)|\.IE($|\/)|\.IL($|\/)|\.IM($|\/)|\.IN($|\/)|\.INFO($|\/)|\.INT($|\/)|\.IO($|\/)|\.IQ($|\/)|\.IR($|\/)|\.IS($|\/)|\.IT($|\/)|\.JE($|\/)|\.JM($|\/)|\.JO($|\/)|\.JOBS($|\/)|\.JP($|\/)|\.KE($|\/)|\.KG($|\/)|\.KH($|\/)|\.KI($|\/)|\.KM($|\/)|\.KN($|\/)|\.KP($|\/)|\.KR($|\/)|\.KW($|\/)|\.KY($|\/)|\.KZ($|\/)|\.LA($|\/)|\.LB($|\/)|\.LC($|\/)|\.LI($|\/)|\.LK($|\/)|\.LR($|\/)|\.LS($|\/)|\.LT($|\/)|\.LU($|\/)|\.LV($|\/)|\.LY($|\/)|\.MA($|\/)|\.MC($|\/)|\.MD($|\/)|\.ME($|\/)|\.MG($|\/)|\.MH($|\/)|\.MIL($|\/)|\.MK($|\/)|\.ML($|\/)|\.MM($|\/)|\.MN($|\/)|\.MO($|\/)|\.MOBI($|\/)|\.MP($|\/)|\.MQ($|\/)|\.MR($|\/)|\.MS($|\/)|\.MT($|\/)|\.MU($|\/)|\.MUSEUM($|\/)|\.MV($|\/)|\.MW($|\/)|\.MX($|\/)|\.MY($|\/)|\.MZ($|\/)|\.NA($|\/)|\.NAME($|\/)|\.NC($|\/)|\.NE($|\/)|\.NET($|\/)|\.NF($|\/)|\.NG($|\/)|\.NI($|\/)|\.NL($|\/)|\.NO($|\/)|\.NP($|\/)|\.NR($|\/)|\.NU($|\/)|\.NZ($|\/)|\.OM($|\/)|\.ORG($|\/)|\.PA($|\/)|\.PE($|\/)|\.PF($|\/)|\.PG($|\/)|\.PH($|\/)|\.PK($|\/)|\.PL($|\/)|\.PM($|\/)|\.PN($|\/)|\.PR($|\/)|\.PRO($|\/)|\.PS($|\/)|\.PT($|\/)|\.PW($|\/)|\.PY($|\/)|\.QA($|\/)|\.RE($|\/)|\.RO($|\/)|\.RS($|\/)|\.RU($|\/)|\.RW($|\/)|\.SA($|\/)|\.SB($|\/)|\.SC($|\/)|\.SD($|\/)|\.SE($|\/)|\.SG($|\/)|\.SH($|\/)|\.SI($|\/)|\.SJ($|\/)|\.SK($|\/)|\.SL($|\/)|\.SM($|\/)|\.SN($|\/)|\.SO($|\/)|\.SR($|\/)|\.ST($|\/)|\.SU($|\/)|\.SV($|\/)|\.SY($|\/)|\.SZ($|\/)|\.TC($|\/)|\.TD($|\/)|\.TEL($|\/)|\.TF($|\/)|\.TG($|\/)|\.TH($|\/)|\.TJ($|\/)|\.TK($|\/)|\.TL($|\/)|\.TM($|\/)|\.TN($|\/)|\.TO($|\/)|\.TP($|\/)|\.TR($|\/)|\.TRAVEL($|\/)|\.TT($|\/)|\.TV($|\/)|\.TW($|\/)|\.TZ($|\/)|\.UA($|\/)|\.UG($|\/)|\.UK($|\/)|\.US($|\/)|\.UY($|\/)|\.UZ($|\/)|\.VA($|\/)|\.VC($|\/)|\.VE($|\/)|\.VG($|\/)|\.VI($|\/)|\.VN($|\/)|\.VU($|\/)|\.WF($|\/)|\.WS($|\/)|\.XN--0ZWM56D($|\/)|\.XN--11B5BS3A9AJ6G($|\/)|\.XN--80AKHBYKNJ4F($|\/)|\.XN--9T4B11YI5A($|\/)|\.XN--DEBA0AD($|\/)|\.XN--G6W251D($|\/)|\.XN--HGBK6AJ7F53BBA($|\/)|\.XN--HLCJ6AYA9ESC7A($|\/)|\.XN--JXALPDLP($|\/)|\.XN--KGBECHTV($|\/)|\.XN--ZCKZAH($|\/)|\.YE($|\/)|\.YT($|\/)|\.YU($|\/)|\.ZA($|\/)|\.ZM($|\/)|\.ZW)/i", diff --git a/bridges/UnsplashBridge.php b/bridges/UnsplashBridge.php index 791ab4cd..553b226e 100644 --- a/bridges/UnsplashBridge.php +++ b/bridges/UnsplashBridge.php @@ -1,17 +1,36 @@ maintainer = "nel50n"; + $this->name = "Unsplash Bridge"; + $this->uri = "http://unsplash.com/"; + $this->description = "Returns the latests photos from Unsplash"; + $this->update = "2015-03-02"; + + $this->parameters[] = + '[ + { + "name" : "Max number of photos", + "identifier" : "m", + "type" : "number" + }, + { + "name" : "Width", + "identifier" : "w", + "exampleValue" : "1920, 1680, ..." + }, + { + "name" : "JPEG quality", + "identifier" : "q", + "type" : "number" + + } + + ]'; + } + public function collectData(array $param){ $html = ''; $baseUri = 'http://unsplash.com'; diff --git a/bridges/WallpaperStopBridge.php b/bridges/WallpaperStopBridge.php index 9d3e20b2..e88921c1 100644 --- a/bridges/WallpaperStopBridge.php +++ b/bridges/WallpaperStopBridge.php @@ -1,21 +1,44 @@ maintainer = "nel50n"; + $this->name = "WallpaperStop Bridge"; + $this->uri = "http://www.wallpaperstop.com/"; + $this->description = "Returns the latests wallpapers from WallpaperStop"; + $this->update = "2014-11-05"; + + $this->parameters[] = + '[ + { + "name" : "Category", + "identifier" : "c" + }, + { + "name" : "subcategory", + "identifier" : "s" + }, + { + "name" : "Max number of wallpapers", + "identifier" : "m", + "type" : "number" + }, + { + "name" : "resolution", + "identifier" : "r", + "exampleValue" : "1920x1200, 1680x1050, ..." + } + + ]'; + + } + + public function collectData(array $param){ $html = ''; if (!isset($param['c'])) { diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php index 060a7b62..96c77c1f 100644 --- a/bridges/WhydBridge.php +++ b/bridges/WhydBridge.php @@ -1,21 +1,27 @@ maintainer = "kranack"; + $this->name = "Whyd Bridge"; + $this->uri = "http://www.whyd.com/"; + $this->description = "Returns 10 newest music from user profile"; + $this->update = "2014-07-18"; + + $this->parameters[] = + '[ + { + "name" : "username/id", + "identifier" : "u" + } + ]'; + + } + public function collectData(array $param){ $html = ''; if (isset($param['u'])) diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index 2a182df3..62085154 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -1,21 +1,32 @@ maintainer = "aledeg"; + $this->name = "Wordpress Bridge"; + $this->uri = "https://wordpress.com/"; + $this->description = "Returns the 3 newest full posts of a Wordpress blog"; + $this->update = "2015-09-05"; + + $this->parameters[] = + '[ + { + "name" : "blog URL", + "required" : "true", + "identifier" : "url" + }, + { + "name" : "Blog name", + "identifier" : "name" + } + ]'; + + } + public function collectData(array $param) { $this->processParams($param); diff --git a/bridges/WorldOfTanks.php b/bridges/WorldOfTanks.php index f4de4773..c6dc7efc 100644 --- a/bridges/WorldOfTanks.php +++ b/bridges/WorldOfTanks.php @@ -1,17 +1,65 @@ fr;English=>en;Español=>es;Deutsch=>de;Čeština=>cs;Polski=>pl;Türkçe=>tr",text|category="Category id") -*/ define('WORLD_OF_TANKS', 'http://worldoftanks.eu/'); define('NEWS', '/news/'); class WorldOfTanks extends HttpCachingBridgeAbstract{ + private $lang = "fr"; public $uri = WORLD_OF_TANKS; - public $name = 'World of tanks news'; + + public function loadMetadatas() { + + $this->maintainer = "mitsukarenai"; + $this->name = "World of Tanks"; + $this->uri = "http://worldoftanks.eu/"; + $this->description = "News about the tank slaughter game."; + $this->update = "2015-09-12"; + + $this->parameters[] = + '[ + { + "name" : "ID de la catégorie", + "type" : "number", + "identifier" : "category" + }, + { + "name" : "Langue", + "identifier" : "lang", + "type" : "list", + "values" : [ + { + "name" : "Français", + "value" : "fr" + }, + { + "name" : "English", + "value" : "en" + }, + { + "name" : "Español", + "value" : "es" + }, + { + "name" : "Deutsch", + "value" : "de" + }, + { + "name" : "Čeština", + "value" : "cs" + }, + { + "name" : "Polski", + "value" : "pl" + }, + { + "name" : "Türkçe", + "value" : "tr" + } + ] + + } + ]'; + } + public function collectData(array $param){ if (!empty($param['lang'])) { diff --git a/bridges/XbooruBridge.php b/bridges/XbooruBridge.php index b575906f..5e0281b9 100644 --- a/bridges/XbooruBridge.php +++ b/bridges/XbooruBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Xbooru"; + $this->uri = "http://xbooru.com/"; + $this->description = "Returns images from given page"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 0;$tags=''; if (isset($param['p'])) { diff --git a/bridges/YandereBridge.php b/bridges/YandereBridge.php index aeb7fdf8..dd479e0b 100644 --- a/bridges/YandereBridge.php +++ b/bridges/YandereBridge.php @@ -1,17 +1,28 @@ maintainer = "mitsukarenai"; + $this->name = "Yande.re"; + $this->uri = "https://yande.re/"; + $this->description = "Returns images from given page and tags"; + $this->update = "2014-05-25"; + + $this->parameters[] = + '[ + { + "name" : "page", + "identifier" : "p", + "type" : "number" + }, + { + "name" : "tags", + "identifier" : "t" + } + ]'; + } + public function collectData(array $param){ $page = 1; $tags = ''; if (isset($param['p'])) { From 4da956f365275d3f4c3a9160883e25362db6a8cb Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 18:05:46 +0000 Subject: [PATCH 11/15] Updating a few bridges. Adding everybody to the contributors in README.md Signed-off-by: teromene --- README.md | 20 ++++++++++++++++++++ bridges/AnimeUltimeBridge.php | 11 ----------- bridges/CryptomeBridge.php | 12 ------------ bridges/LeBonCoinBridge.php | 13 ------------- bridges/MspabooruBridge.php | 11 ----------- bridges/SoundcloudBridge.php | 12 ------------ bridges/TwitchApiBridge.php | 18 +----------------- 7 files changed, 21 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 90edc4d8..55dfe7e9 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,26 @@ Patch/contributors : * [Polopollo](https://github.com/Polopollo) * [16mhz](https://github.com/16mhz) * [kranack](https://github.com/kranack) + * [logmanoriginal](https://github.com/logmanoriginal) + * [polo2ro](https://github.com/polo2ro) + * [Riduidel](https://github.com/Riduidel) + * [superbaillot.net](http://superbaillot.net/) + * [vinzv](https://github.com/vinzv) + * [teromene](https://github.com/teromene) + * [nel50n](https://github.com/nel50n) + * [nyutag](https://github.com/nyutag) + * [ORelio](https://github.com/ORelio) + * [Pitchoule](https://github.com/Pitchoule) + * [pit-fgfjiudghdf](https://github.com/pit-fgfjiudghdf) + * [aledeg](https://github.com/aledeg) + * [alexAubin](https://github.com/alexAubin) + * [cnlpete](https://github.com/cnlpete) + * [corenting](https://github.com/corenting) + * [Daiyousei](https://github.com/Daiyousei) + * [erwang](https://github.com/erwang) + * [gsurrel](https://github.com/gsurrel) + * [kraoc](https://github.com/kraoc) + * [lagaisse](https://github.com/lagaisse) License === diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 97955de0..68e199e7 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -1,15 +1,4 @@ ;Anime=>A;Drama=>D;Tokusatsu=>T") - */ class AnimeUltimeBridge extends BridgeAbstract { private $filter = 'Releases'; diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index e12e0c34..c76e0aac 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -1,16 +1,4 @@ alsace;Aquitaine=>aquitaine;Auvergne=>auvergne;Basse Normandie=>basse_normandie;Bourgogne=>bourgogne;Bretagne=>bretagne;Centre=>centre;Champagne Ardenne=>champagne_ardenne;Corse=>corse;Franche Comté=>franche_comte;Haute Normandie=>haute_normandie;Ile de France=>ile_de_france;Languedoc Roussillon=>languedoc_roussillon;Limousin=>limousin;Lorraine=>lorraine;Midi Pyrénées=>midi_pyrenees;Nord Pas De Calais=>nord_pas_de_calais;Pays de la Loire=>pays_de_la_loire;Picardie=>picardie;Poitou Charentes=>poitou_charentes;Provence Alpes Côte d'Azur=>provence_alpes_cote_d_azur;Rhône-Alpes=>rhone_alpes;Guadeloupe=>guadeloupe;Martinique=>martinique;Guyane=>guyane;Réunion=>reunion", text|k="Keyword") -*/ - class LeBonCoinBridge extends BridgeAbstract{ public function loadMetadatas() { diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php index f949026c..04c378df 100644 --- a/bridges/MspabooruBridge.php +++ b/bridges/MspabooruBridge.php @@ -1,15 +1,4 @@ true;Don't show broadcasts=>false") -* @use2(text|channel="Channel", text|limit="Limit", list|broadcasts="Show broadcasts=>true;Don't show broadcasts=>false") -* -* Description for the API is available on GitHub: https://github.com/justintv/twitch-api -*/ - define('TWITCH_LIMIT', 10); // The default limit define('TWITCH_BROADCASTS', 'false'); // The default flag for broadcasts class TwitchApiBridge extends BridgeAbstract{ - + // for use in the getName function! private $channel; From d033bb51ac7bcaab553c272cb5ce38d6828c39e9 Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 20:26:48 +0000 Subject: [PATCH 12/15] Little refactoring to reduce logic on index.php. Moved RssExpander as a core logic system to lib/Bridge.php Signed-off-by: teromene --- bridges/Freenews.php | 6 +- bridges/Gawker.php | 4 +- bridges/Les400Culs.php | 9 +-- bridges/RssExpander.php | 68 ------------------ bridges/TheOatMealBridge.php | 6 +- index.php | 134 +++-------------------------------- lib/Bridge.php | 66 +++++++++++++++++ lib/HTMLUtils.php | 119 +++++++++++++++++++++++++++++++ lib/RssBridge.php | 1 + 9 files changed, 201 insertions(+), 212 deletions(-) delete mode 100644 bridges/RssExpander.php create mode 100644 lib/HTMLUtils.php diff --git a/bridges/Freenews.php b/bridges/Freenews.php index e1cf094c..ecdd4610 100644 --- a/bridges/Freenews.php +++ b/bridges/Freenews.php @@ -1,6 +1,5 @@ toURI(strtolower($param['site'])); } // $this->message("loading feed from ".$this->getURI()); - parent::collectData($param); + parent::collectExpandableDatas($param, $name); } protected function parseRSSItem($newsItem) { diff --git a/bridges/Les400Culs.php b/bridges/Les400Culs.php index 4694f406..36dc0a80 100644 --- a/bridges/Les400Culs.php +++ b/bridges/Les400Culs.php @@ -1,11 +1,7 @@ returnError('There is no $param[\'url\'] for this RSS expander', 404); - } -// $this->message("Loading from ".$param['url']); - // Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time - $rssContent = simplexml_load_file($param['url']) or $this->returnError('Could not request '.$param['url'], 404); -// $this->message("loaded RSS from ".$param['url']); - // TODO insert RSS format detection - // we suppose for now, we have some RSS 2.0 - $this->collect_RSS_2_0_data($rssContent); - } - - protected function collect_RSS_2_0_data($rssContent) { - $rssContent = $rssContent->channel[0]; -// $this->message("RSS content is ===========\n".var_export($rssContent, true)."==========="); - $this->load_RSS_2_0_feed_data($rssContent); - foreach($rssContent->item as $item) { -// $this->message("parsing item ".var_export($item, true)); - $this->items[] = $this->parseRSSItem($item); - } - } - - protected function RSS_2_0_time_to_timestamp($item) { - return DateTime::createFromFormat('D, d M Y H:i:s e', $item->pubDate)->getTimestamp(); - } - - // TODO set title, link, description, language, and so on - protected function load_RSS_2_0_feed_data($rssContent) { - $this->name = trim($rssContent->title); - $this->uri = trim($rssContent->link); - $this->description = trim($rssContent->description); - } - - /** - * Method should return, from a source RSS item given by lastRSS, one of our Items objects - * @param $item the input rss item - * @return a RSS-Bridge Item, with (hopefully) the whole content) - */ - abstract protected function parseRSSItem($item); - - - public function getName(){ - return $this->name; - } - - public function getURI(){ - return $this->uri; - } - - public function getDescription() { - return $this->description; - } -} diff --git a/bridges/TheOatMealBridge.php b/bridges/TheOatMealBridge.php index ba431c88..97aae693 100644 --- a/bridges/TheOatMealBridge.php +++ b/bridges/TheOatMealBridge.php @@ -1,7 +1,4 @@ getMessage()); } -function getHelperButtonFormat($value, $name){ - return ''; -} - -function getHelperButtonsFormat($formats){ - $buttons = ''; - foreach( $formats as $name => $infos ) - { - if ( isset($infos['name']) ) - { - $buttons .= getHelperButtonFormat($name, $infos['name']) . PHP_EOL; - } - } - return $buttons; -} - -function displayBridgeCard($bridgeName, $formats, $isActive = true) -{ - - - $bridgeElement = Bridge::create($bridgeName); - if($bridgeElement == false) { - return ""; - } - $bridgeElement->loadMetadatas(); - - $name = ''.$bridgeElement->name.''; - $description = $bridgeElement->description; - - $card = << -

      {$name}

      -

      - {$description} -

      -CARD; - - // If we don't have any parameter for the bridge, we print a generic form to load it. - if(count($bridgeElement->parameters) == 0) { - - $card .= ' - - ' . PHP_EOL; - - if ($isActive) - { - $card .= getHelperButtonsFormat($formats); - } - else - { - $card .= 'Inactive'; - } - $card .= '' . PHP_EOL; - - } - - foreach($bridgeElement->parameters as $parameterName => $parameter) - { - $card .= '
        ' . PHP_EOL; - if(!is_numeric($parameterName)) { - $card .= '
        '.$parameterName.'
        ' . PHP_EOL; - } - $card .= '
        - - ' . PHP_EOL; - - $parameter = json_decode($parameter, true); - - foreach($parameter as $inputEntry) { - - if(!isset($inputEntry['exampleValue'])) $inputEntry['exampleValue'] = ""; - - $idArg = 'arg-' . $bridgeName . '-' . $parameterName . '-' . $inputEntry['identifier']; - - $card .= '' . PHP_EOL; - - if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { - $card .= '
        ' . PHP_EOL; - } else if($inputEntry['type'] == 'number') { - $card .= '
        ' . PHP_EOL; - } else if($inputEntry['type'] == 'list') { - $card .= '
        '; - } else if($inputEntry['type'] == 'checkbox') { - - $card .= '
        ' . PHP_EOL; - - } - - } - if ($isActive) - { - $card .= getHelperButtonsFormat($formats); - } - else - { - $card .= 'Inactive'; - } - $card .= '
        ' . PHP_EOL; - - } - - $card .= ''.$bridgeElement->maintainer.''; - $card .= ''; - - return $card; -} - $formats = Format::searchInformation(); ?> @@ -265,23 +146,24 @@ $formats = Format::searchInformation(); $activeFoundBridgeCount = 0; $showInactive = isset($_REQUEST['show_inactive']) && $_REQUEST['show_inactive'] == 1; $inactiveBridges = ''; - foreach(Bridge::listBridges() as $bridgeName) + $bridgeList = Bridge::listBridges(); + foreach($bridgeList as $bridgeName) { - if(BridgeWhitelist($whitelist_selection, $bridgeName)) + if(Bridge::isWhitelisted($whitelist_selection, $bridgeName)) { - echo displayBridgeCard($bridgeName, $formats); + echo HTMLUtils::displayBridgeCard($bridgeName, $formats); $activeFoundBridgeCount++; } elseif ($showInactive) { // inactive bridges - $inactiveBridges .= displayBridgeCard($bridgeName, $formats, false) . PHP_EOL; + $inactiveBridges .= HTMLUtils::displayBridgeCard($bridgeName, $formats, false) . PHP_EOL; } } echo '
        ' . $inactiveBridges; ?> diff --git a/lib/Bridge.php b/lib/Bridge.php index 6ff1c389..93032100 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -293,6 +293,72 @@ class Bridge{ return $listBridge; } + static function isWhitelisted( $whitelist, $name ) { + if(in_array("$name", $whitelist) or in_array("$name.php", $whitelist)) + return TRUE; + else + return FALSE; + } } +abstract class RssExpander extends HttpCachingBridgeAbstract{ + + public $name; + public $uri; + public $description; + + public function collectExpandableDatas(array $param, $name){ + if (empty($name)) { + $this->returnError('There is no $param[\'url\'] for this RSS expander', 404); + } +// $this->message("Loading from ".$param['url']); + // Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time + $rssContent = simplexml_load_file($name) or $this->returnError('Could not request '.$name, 404); +// $this->message("loaded RSS from ".$param['url']); + // TODO insert RSS format detection + // we suppose for now, we have some RSS 2.0 + $this->collect_RSS_2_0_data($rssContent); + } + + protected function collect_RSS_2_0_data($rssContent) { + $rssContent = $rssContent->channel[0]; +// $this->message("RSS content is ===========\n".var_export($rssContent, true)."==========="); + $this->load_RSS_2_0_feed_data($rssContent); + foreach($rssContent->item as $item) { +// $this->message("parsing item ".var_export($item, true)); + $this->items[] = $this->parseRSSItem($item); + } + } + + protected function RSS_2_0_time_to_timestamp($item) { + return DateTime::createFromFormat('D, d M Y H:i:s e', $item->pubDate)->getTimestamp(); + } + + // TODO set title, link, description, language, and so on + protected function load_RSS_2_0_feed_data($rssContent) { + $this->name = trim($rssContent->title); + $this->uri = trim($rssContent->link); + $this->description = trim($rssContent->description); + } + + /** + * Method should return, from a source RSS item given by lastRSS, one of our Items objects + * @param $item the input rss item + * @return a RSS-Bridge Item, with (hopefully) the whole content) + */ + abstract protected function parseRSSItem($item); + + + public function getName(){ + return $this->name; + } + + public function getURI(){ + return $this->uri; + } + + public function getDescription() { + return $this->description; + } +} diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php new file mode 100644 index 00000000..85c0dbe2 --- /dev/null +++ b/lib/HTMLUtils.php @@ -0,0 +1,119 @@ +' . $name . ''; + } + + public static function getHelperButtonsFormat($formats){ + $buttons = ''; + foreach( $formats as $name => $infos ) + { + if ( isset($infos['name']) ) + { + $buttons .= HTMLUtils::getHelperButtonFormat($name, $infos['name']) . PHP_EOL; + } + } + return $buttons; + } + + public static function displayBridgeCard($bridgeName, $formats, $isActive = true) + { + + + $bridgeElement = Bridge::create($bridgeName); + if($bridgeElement == false) { + return ""; + } + $bridgeElement->loadMetadatas(); + + $name = ''.$bridgeElement->name.''; + $description = $bridgeElement->description; + + $card = << +

        {$name}

        +

        + {$description} +

        +CARD; + + // If we don't have any parameter for the bridge, we print a generic form to load it. + if(count($bridgeElement->parameters) == 0) { + + $card .= '
        + + ' . PHP_EOL; + + if ($isActive) + { + $card .= HTMLUtils::getHelperButtonsFormat($formats); + } + else + { + $card .= 'Inactive'; + } + $card .= '
        ' . PHP_EOL; + + } + + foreach($bridgeElement->parameters as $parameterName => $parameter) + { + $card .= '
          ' . PHP_EOL; + if(!is_numeric($parameterName)) { + $card .= '
          '.$parameterName.'
          ' . PHP_EOL; + } + $card .= '
          + + ' . PHP_EOL; + + $parameter = json_decode($parameter, true); + + foreach($parameter as $inputEntry) { + + if(!isset($inputEntry['exampleValue'])) $inputEntry['exampleValue'] = ""; + + $idArg = 'arg-' . $bridgeName . '-' . $parameterName . '-' . $inputEntry['identifier']; + + $card .= '' . PHP_EOL; + + if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { + $card .= '
          ' . PHP_EOL; + } else if($inputEntry['type'] == 'number') { + $card .= '
          ' . PHP_EOL; + } else if($inputEntry['type'] == 'list') { + $card .= '
          '; + } else if($inputEntry['type'] == 'checkbox') { + + $card .= '
          ' . PHP_EOL; + + } + + } + if ($isActive) + { + $card .= HTMLUtils::getHelperButtonsFormat($formats); + } + else + { + $card .= 'Inactive'; + } + $card .= '
          ' . PHP_EOL; + + } + + $card .= ''.$bridgeElement->maintainer.''; + $card .= ''; + + return $card; + } + + +} +?> diff --git a/lib/RssBridge.php b/lib/RssBridge.php index 5e0824ff..a515a4ff 100644 --- a/lib/RssBridge.php +++ b/lib/RssBridge.php @@ -12,6 +12,7 @@ require __DIR__ . '/Item.php'; require __DIR__ . '/Format.php'; require __DIR__ . '/Bridge.php'; require __DIR__ . '/Cache.php'; +require __DIR__ . '/HTMLUtils.php'; $vendorLibSimpleHtmlDom = __DIR__ . PATH_VENDOR . '/simplehtmldom/simple_html_dom.php'; if( !file_exists($vendorLibSimpleHtmlDom) ){ From e1cdca6971468fc5216e6a69f06ec535a82a24a2 Mon Sep 17 00:00:00 2001 From: Teromene Date: Wed, 11 Nov 2015 21:45:24 +0000 Subject: [PATCH 13/15] =?UTF-8?q?Ajout=20du=20param=C3=A8tre=20pattern=20p?= =?UTF-8?q?our=20les=20entr=C3=A9es=20de=20type=20texte,=20ajout=20du=20re?= =?UTF-8?q?quired=20c=C3=B4t=C3=A9=20HTML.=20Correction=20de=20la=20page?= =?UTF-8?q?=20d'accueuil=20pour=20qu'elle=20soit=20conforme=20aux=20standa?= =?UTF-8?q?rds=20du=20W3C.=20Correction=20de=20la=20regex=20de=20listage?= =?UTF-8?q?=20des=20fichiers=20pour=20qu'elle=20ignore=20les=20sauvegardes?= =?UTF-8?q?.=20Ajout=20d'un=20nettoyeur=20HTML,=20par=20d=C3=A9faut.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridges/FacebookBridge.php | 3 +- bridges/PickyWallpapersBridge.php | 3 +- bridges/YoutubeBridge.php | 6 ++- index.php | 5 +-- lib/Bridge.php | 17 ++++---- lib/HTMLUtils.php | 71 +++++++++++++++++++++++++++---- lib/Item.php | 2 +- 7 files changed, 81 insertions(+), 26 deletions(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index 98e7e8b6..49c8d26f 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -13,7 +13,8 @@ class FacebookBridge extends BridgeAbstract{ '[ { "name" : "Username", - "identifier" : "u" + "identifier" : "u", + "required" : "required" } ]'; } diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index 87cfb166..586d06aa 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -31,7 +31,8 @@ class PickyWallpapersBridge extends BridgeAbstract { { "name" : "resolution", "identifier" : "r", - "exampleValue" : "1920x1200, 1680x1050, ..." + "exampleValue" : "1920x1200, 1680x1050, ...", + "pattern" : "[0-9]{3,4}x[0-9]{3,4}" } ]'; diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php index bcc6d2f6..7147a23e 100644 --- a/bridges/YoutubeBridge.php +++ b/bridges/YoutubeBridge.php @@ -23,7 +23,8 @@ class YoutubeBridge extends BridgeAbstract { "type" : "text", "identifier" : "u", "name" : "username", - "exampleValue" : "test" + "exampleValue" : "test", + "required" : "required" } ]'; @@ -33,7 +34,8 @@ class YoutubeBridge extends BridgeAbstract { "type" : "number", "identifier" : "c", "name" : "channel id", - "exampleValue" : "15" + "exampleValue" : "15", + "required" : "required" } ]'; diff --git a/index.php b/index.php index 6b8261bd..0d6bb9ba 100644 --- a/index.php +++ b/index.php @@ -131,9 +131,6 @@ $formats = Format::searchInformation(); RSS-Bridge - @@ -152,7 +149,7 @@ $formats = Format::searchInformation(); if(Bridge::isWhitelisted($whitelist_selection, $bridgeName)) { echo HTMLUtils::displayBridgeCard($bridgeName, $formats); - $activeFoundBridgeCount++; + $activeFoundBridgeCount++; } elseif ($showInactive) { diff --git a/lib/Bridge.php b/lib/Bridge.php index 93032100..6fb67b7f 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -279,15 +279,16 @@ class Bridge{ */ static public function listBridges() { - $pathDirBridge = self::getDir(); - $listBridge = array(); - $dirFiles = scandir($pathDirBridge); + $pathDirBridge = self::getDir(); + $listBridge = array(); + $dirFiles = scandir($pathDirBridge); - if( $dirFiles !== false ){ - foreach( $dirFiles as $fileName ){ - if( preg_match('@([^.]+)\.php@U', $fileName, $out) ){ - $listBridge[] = $out[1]; - } + if( $dirFiles !== false ){ + + foreach( $dirFiles as $fileName ) { + if( preg_match('@([^.]+)\.php$@U', $fileName, $out) ){ + $listBridge[] = $out[1]; + } } } diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index 85c0dbe2..ff25130d 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -20,7 +20,6 @@ class HTMLUtils { public static function displayBridgeCard($bridgeName, $formats, $isActive = true) { - $bridgeElement = Bridge::create($bridgeName); if($bridgeElement == false) { return ""; @@ -41,7 +40,7 @@ CARD; // If we don't have any parameter for the bridge, we print a generic form to load it. if(count($bridgeElement->parameters) == 0) { - $card .= '
          + $card .= ' ' . PHP_EOL; @@ -59,11 +58,10 @@ CARD; foreach($bridgeElement->parameters as $parameterName => $parameter) { - $card .= '
            ' . PHP_EOL; if(!is_numeric($parameterName)) { $card .= '
            '.$parameterName.'
            ' . PHP_EOL; } - $card .= ' + $card .= ' ' . PHP_EOL; @@ -71,21 +69,32 @@ CARD; foreach($parameter as $inputEntry) { + $additionalInfoString = ""; + if(isset($inputEntry['required'])) { + + $additionalInfoString .= " required=\"required\""; + + } + if(isset($inputEntry['pattern'])) { + + $additionalInfoString .= " pattern=\"".$inputEntry['pattern']."\""; + + } if(!isset($inputEntry['exampleValue'])) $inputEntry['exampleValue'] = ""; - $idArg = 'arg-' . $bridgeName . '-' . $parameterName . '-' . $inputEntry['identifier']; + $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode($parameterName) . '-' . urlencode($inputEntry['identifier']); $card .= '' . PHP_EOL; if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { - $card .= '
            ' . PHP_EOL; + $card .= '
            ' . PHP_EOL; } else if($inputEntry['type'] == 'number') { - $card .= '
            ' . PHP_EOL; + $card .= '
            ' . PHP_EOL; } else if($inputEntry['type'] == 'list') { - $card .= ''; foreach($inputEntry['values'] as $listValues) { - $card .= ""; + $card .= ""; } $card .= '
            '; @@ -115,5 +124,49 @@ CARD; } +} + +class HTMLSanitizer { + + + var $tagsToRemove; + var $keptAttributes; + var $onlyKeepText; + + const DEFAULT_CLEAR_TAGS = ["script", "iframe"]; + const KEPT_ATTRIBUTES = ["title", "href", "src"]; + + const ONLY_TEXT = null; + + function __construct($tags_to_remove = HTMLSanitizer::DEFAULT_CLEAR_TAGS, $kept_attributes = HTMLSanitizer::KEPT_ATTRIBUTES, $only_keep_text = HTMLSanitizer::ONLY_TEXT) { + + $this->tagsToRemove = $tags_to_remove; + $this->keptAttributes = $kept_attributes; + $this->onlyKeepText = $only_keep_text; + + } + + function sanitize($textToSanitize) { + + $htmlContent = str_get_html($textToSanitize); + + foreach($htmlContent->find('*[!j_ai_pas_trouve_comment_tout_demander]') as $element) { + if(in_array($element->tag, $this->onlyKeepText)) { + $element->outertext = $element->plaintext; + } else if(in_array($element->tag, $this->tagsToRemove)) { + $element->outertext = ''; + } else { + foreach($element->getAllAttributes() as $attributeName => $attribute) { + + if(!in_array($attributeName, $this->keptAttributes)) $element->removeAttribute($attributeName); + + } + } + } + + return $htmlContent; + + } + } ?> diff --git a/lib/Item.php b/lib/Item.php index 806ecca8..2e15ffc3 100644 --- a/lib/Item.php +++ b/lib/Item.php @@ -13,4 +13,4 @@ class Item implements ItemInterface{ public function __get($name){ return isset($this->$name) ? $this->$name : null; } -} \ No newline at end of file +} From a07839019ef4478de7e01786d387f996d42bb9b9 Mon Sep 17 00:00:00 2001 From: Teromene Date: Fri, 27 Nov 2015 14:20:33 +0000 Subject: [PATCH 14/15] =?UTF-8?q?Correction=20de=20quelques=20probl=C3=A8m?= =?UTF-8?q?es=20avec=20RSSExpander=20suite=20=C3=A0=20la=20migration=20dan?= =?UTF-8?q?s=20lib/Bridge.=20Correction=20de=20typos.=20Ajout=20de=20la=20?= =?UTF-8?q?possibilit=C3=A9=20d'utiliser=20un=20proxy.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridges/Gawker.php | 6 ++--- bridges/WorldOfTanks.php | 2 +- index.php | 3 +++ lib/Bridge.php | 33 ++++++++++++++---------- lib/HTMLUtils.php | 11 +++++--- vendor/simplehtmldom/simple_html_dom.php | 4 +-- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/bridges/Gawker.php b/bridges/Gawker.php index efb75d82..624e66db 100644 --- a/bridges/Gawker.php +++ b/bridges/Gawker.php @@ -31,10 +31,10 @@ class Gawker extends RssExpander{ trigger_error("If no site is provided, nothing is gonna happen", E_USER_ERROR); } else { $this->name = $param['site']; - $param['url'] = $this->toURI(strtolower($param['site'])); + $url = $this->toURI(strtolower($param['site'])); } // $this->message("loading feed from ".$this->getURI()); - parent::collectExpandableDatas($param, $name); + parent::collectExpandableDatas($param, $url); } protected function parseRSSItem($newsItem) { @@ -49,7 +49,7 @@ class Gawker extends RssExpander{ $articlePage = str_get_html($this->get_cached($item->uri)); if(is_object($articlePage)) { $content = $articlePage->find('.post-content', 0); - $this->defaultImageSrcTo($content, $this->getURI()); + HTMLSanitizer::defaultImageSrcTo($content, $this->getURI()); $vcard = $articlePage->find('.vcard', 0); if(is_object($vcard)) { $authorLink = $vcard->find('a', 0); diff --git a/bridges/WorldOfTanks.php b/bridges/WorldOfTanks.php index c6dc7efc..adaf22c3 100644 --- a/bridges/WorldOfTanks.php +++ b/bridges/WorldOfTanks.php @@ -86,7 +86,7 @@ class WorldOfTanks extends HttpCachingBridgeAbstract{ // $this->message("loading page ".$item->uri); $articlePage = str_get_html($this->get_cached($item->uri)); $content = $articlePage->find('.l-content', 0); - $this->defaultImageSrcTo($content, WORLD_OF_TANKS); + HTMLSanitizer::defaultImageSrcTo($content, WORLD_OF_TANKS); $item->title = $content->find('h1', 0)->innertext; $item->content = $content->find('.b-content', 0)->innertext; // $item->name = $auteur->innertext; diff --git a/index.php b/index.php index 0d6bb9ba..63d72b83 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,8 @@ TODO : - implement header('X-Cached-Version: '.date(DATE_ATOM, filemtime($cachefile))); */ +//define('PROXY_URL', 'tcp://192.168.0.0:28'); + date_default_timezone_set('UTC'); error_reporting(0); //ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only. @@ -21,6 +23,7 @@ if (!extension_loaded('openssl')) // FIXME : beta test UA spoofing, please report any blacklisting by PHP-fopen-unfriendly websites ini_set('user_agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20121202 Firefox/30.0 (rss-bridge/0.1; +https://github.com/sebsauvage/rss-bridge)'); + // ------- // default whitelist diff --git a/lib/Bridge.php b/lib/Bridge.php index 6fb67b7f..3a104a1b 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -39,7 +39,7 @@ abstract class BridgeAbstract implements BridgeInterface{ } /** - * Return datas store in the bridge + * Return datas stored in the bridge * @return mixed */ public function getDatas(){ @@ -50,7 +50,7 @@ abstract class BridgeAbstract implements BridgeInterface{ /** * Defined datas with parameters depending choose bridge - * Note : you can defined a cache before with "setCache" + * Note : you can define a cache before with "setCache" * @param array $param $_REQUEST, $_GET, $_POST, or array with bridge expected paramters */ public function setDatas(array $param){ @@ -90,16 +90,6 @@ abstract class BridgeAbstract implements BridgeInterface{ return $this; } - /** - * Set default image SRC attribute to point on given server when none is provided (that's to say when image src starts with '/' - */ - public function defaultImageSrcTo($content, $server) { - foreach($content->find('img') as $image) { - if(strpos($image->src, '/')==0) { - $image->src = $server.$image->src; - } - } - } } /** @@ -311,7 +301,7 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{ public function collectExpandableDatas(array $param, $name){ if (empty($name)) { - $this->returnError('There is no $param[\'url\'] for this RSS expander', 404); + $this->returnError('There is no $name for this RSS expander', 404); } // $this->message("Loading from ".$param['url']); // Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time @@ -363,3 +353,20 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{ return $this->description; } } + +function advanced_file_get_contents($url) { + + if(defined('PROXY_URL')) { + $context = array( + 'http' => array( + 'proxy' => PROXY_URL, + 'request_fulluri' => true, + ), + ); + $context = stream_context_create($context); + return file_get_contents($url, false, $context); + } else { + return file_get_contents($url); + } + +} diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index ff25130d..9f097230 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -91,7 +91,7 @@ CARD; } else if($inputEntry['type'] == 'number') { $card .= '
            ' . PHP_EOL; } else if($inputEntry['type'] == 'list') { - $card .= ''; foreach($inputEntry['values'] as $listValues) { $card .= ""; @@ -157,9 +157,7 @@ class HTMLSanitizer { $element->outertext = ''; } else { foreach($element->getAllAttributes() as $attributeName => $attribute) { - if(!in_array($attributeName, $this->keptAttributes)) $element->removeAttribute($attributeName); - } } } @@ -167,6 +165,13 @@ class HTMLSanitizer { return $htmlContent; } + public static function defaultImageSrcTo($content, $server) { + foreach($content->find('img') as $image) { + if(strpos($image->src, '/')==0) { + $image->src = $server.$image->src; + } + } + } } ?> diff --git a/vendor/simplehtmldom/simple_html_dom.php b/vendor/simplehtmldom/simple_html_dom.php index b5d30898..22aaa340 100644 --- a/vendor/simplehtmldom/simple_html_dom.php +++ b/vendor/simplehtmldom/simple_html_dom.php @@ -73,7 +73,7 @@ function file_get_html($url, $use_include_path = false, $context=null, $offset = // We DO force the tags to be terminated. $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done. - $contents = file_get_contents($url, $use_include_path, $context, $offset); + $contents = advanced_file_get_contents($url, $use_include_path, $context, $offset); // Paperg - use our own mechanism for getting the contents as we want to control the timeout. //$contents = retrieve_url_contents($url); if (empty($contents) || strlen($contents) > MAX_FILE_SIZE) @@ -1094,7 +1094,7 @@ class simple_html_dom function load_file() { $args = func_get_args(); - $this->load(call_user_func_array('file_get_contents', $args), true); + $this->load(call_user_func_array('advanced_file_get_contents', $args), true); // Throw an error if we can't properly load the dom. if (($error=error_get_last())!==null) { $this->clear(); From f386fc4a109c8ee12c6dc51333f0ecdf077268a8 Mon Sep 17 00:00:00 2001 From: Teromene Date: Fri, 4 Dec 2015 09:19:05 +0000 Subject: [PATCH 15/15] Added the Cache cleaning system. --- index.php | 7 +++---- lib/Cache.php | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 63d72b83..5578b2de 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,6 @@ getBasename(), array('.', '..'))) + continue; + elseif ($cacheFile->isFile()) { + if( filemtime($cacheFile->getPathname()) < $cacheTimeLimit ) + unlink( $cacheFile->getPathname() ); + } + } + } + } + +}