This commit is contained in:
az5he6ch 2016-08-14 20:16:27 +09:30
commit ceb3e9a039
159 changed files with 2756 additions and 3736 deletions

5
.gitignore vendored
View file

@ -227,3 +227,8 @@ pip-log.txt
/cache /cache
/whitelist.txt /whitelist.txt
DEBUG DEBUG
######################
## VisualStudioCode ##
######################
.vscode/*

View file

@ -1,105 +0,0 @@
# 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.
##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 `<form>` 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'] = ...
```
It is worth mentionning that you can also define a set of parameters that will be applied to every possible utilisation of your bridge.
To do this, just create a parameter array with the `global` key.
### 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
title| text | Will be shown as tooltip when mouse-hovering over the input
#### Guidelines
* scripts (eg. Javascript) must be stripped out. Make good use of `strip_tags()` and `preg_replace()`
* bridge must present data within 8 seconds (adjust iterators accordingly)
* cache timeout must be fine-tuned so that each refresh can provide 1 or 2 new elements on busy periods
* `<audio>` and `<video>` must not autoplay. Seriously.
* do everything you can to extract valid timestamps. Translate formats, use API, exploit sitemap, whatever. Free the data!
* don't create duplicates. If the website runs on WordPress, use the generic WordPress bridge if possible.
* maintain efficient and well-commented code :wink:

View file

@ -1,5 +1,6 @@
rss-bridge rss-bridge
=== ===
[![LICENSE](https://img.shields.io/badge/license-UNLICENSE-blue.svg)](UNLICENSE)
rss-bridge is a PHP project capable of generating ATOM feeds for websites which don't have one. rss-bridge is a PHP project capable of generating ATOM feeds for websites which don't have one.
@ -19,9 +20,7 @@ Supported sites/pages (main)
* `OpenClassrooms`: Lastest tutorials from [fr.openclassrooms.com](http://fr.openclassrooms.com/) * `OpenClassrooms`: Lastest tutorials from [fr.openclassrooms.com](http://fr.openclassrooms.com/)
* `Pinterest`: Most recent photos from user or search * `Pinterest`: Most recent photos from user or search
* `ScmbBridge`: Newest stories from [secouchermoinsbete.fr](http://secouchermoinsbete.fr/) * `ScmbBridge`: Newest stories from [secouchermoinsbete.fr](http://secouchermoinsbete.fr/)
* `WikipediaENLatest`: highlighted articles from Wikipedia in English * `Wikipedia`: highlighted articles from [Wikipedia](https://wikipedia.org/) in English, German, French or Esperanto
* `WikipediaFRLatest`: highlighted articles from Wikipedia in French
* `WikipediaEOLatest`: highlighted articles from Wikipedia in Esperanto
* `Bandcamp` : Returns last release from [bandcamp](https://bandcamp.com/) for a tag * `Bandcamp` : Returns last release from [bandcamp](https://bandcamp.com/) for a tag
* `ThePirateBay` : Returns the newest indexed torrents from [The Pirate Bay](https://thepiratebay.se/) with keywords * `ThePirateBay` : Returns the newest indexed torrents from [The Pirate Bay](https://thepiratebay.se/) with keywords
* `Facebook` : Returns the latest posts on a page or profile on [Facebook](https://facebook.com/) * `Facebook` : Returns the latest posts on a page or profile on [Facebook](https://facebook.com/)
@ -33,6 +32,7 @@ Output format
Output format can take several forms: Output format can take several forms:
* `Atom` : ATOM Feed, for use in RSS/Feed readers * `Atom` : ATOM Feed, for use in RSS/Feed readers
* `Mrss` : MRSS Feed, for use in RSS/Feed readers
* `Json` : Json, for consumption by other applications. * `Json` : Json, for consumption by other applications.
* `Html` : Simple html page. * `Html` : Simple html page.
* `Plaintext` : raw text (php object, as returned by print_r) * `Plaintext` : raw text (php object, as returned by print_r)
@ -42,11 +42,11 @@ Screenshot
Welcome screen: Welcome screen:
![Screenshot](http://sebsauvage.net/galerie/photos/Bordel/rss-bridge-screenshot-3.png) ![Screenshot](https://github.com/RSS-Bridge/rss-bridge/wiki/images/screenshot_rss-bridge_welcome.png)
Minecraft hashtag (#Minecraft) search on Twitter, in ATOM format (as displayed by Firefox): RSS-Bridge hashtag (#rss-bridge) search on Twitter, in ATOM format (as displayed by Firefox):
![Screenshot](http://sebsauvage.net/galerie/photos/Bordel/rss-bridge-screenshot-2-twitter-hashtag.png) ![Screenshot](https://github.com/RSS-Bridge/rss-bridge/wiki/images/screenshot_twitterbridge_atom.png)
Requirements Requirements
=== ===
@ -61,15 +61,19 @@ By default, the script creates `whitelist.txt` and adds the main bridges (see ab
* to enable extra bridges (one bridge per line) * to enable extra bridges (one bridge per line)
* to disable main bridges (remove the line) * to disable main bridges (remove the line)
New bridges are disabled by default, so make sure to check regularly what's new and whitelist what you want ! New bridges are disabled by default, so make sure to check regularly what's new and whitelist what you want!
Author Deploy
=== ===
I'm sebsauvage, webmaster of [sebsauvage.net](http://sebsauvage.net), author of [Shaarli](http://sebsauvage.net/wiki/doku.php?id=php:shaarli) and [ZeroBin](http://sebsauvage.net/wiki/doku.php?id=php:zerobin). [![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/sebsauvage/rss-bridge)
Authors
===
We are RSS Bridge Community, a group of developers continuing the project initiated by sebsauvage, webmaster of [sebsauvage.net](http://sebsauvage.net), author of [Shaarli](http://sebsauvage.net/wiki/doku.php?id=php:shaarli) and [ZeroBin](http://sebsauvage.net/wiki/doku.php?id=php:zerobin).
Patch/contributors : Patch/contributors :
* Yves ASTIER ([Draeli](https://github.com/Draeli)) : PHP optimizations, fixes, dynamic brigde/format list with all stuff behind and extend cache system. Mail : contact@yves-astier.com * Yves ASTIER ([Draeli](https://github.com/Draeli)) : PHP optimizations, fixes, dynamic brigde/format list with all stuff behind and extend cache system. Mail : contact /at\ yves-astier.com
* [Mitsukarenai](https://github.com/Mitsukarenai) : Initial inspiration, collaborator * [Mitsukarenai](https://github.com/Mitsukarenai) : Initial inspiration, collaborator
* [ArthurHoaro](https://github.com/ArthurHoaro) * [ArthurHoaro](https://github.com/ArthurHoaro)
* [BoboTiG](https://github.com/BoboTiG) * [BoboTiG](https://github.com/BoboTiG)
@ -102,7 +106,7 @@ Patch/contributors :
* [kraoc](https://github.com/kraoc) * [kraoc](https://github.com/kraoc)
* [lagaisse](https://github.com/lagaisse) * [lagaisse](https://github.com/lagaisse)
License Licenses
=== ===
Code is [Public Domain](UNLICENSE). Code is [Public Domain](UNLICENSE).
@ -111,9 +115,10 @@ Including `PHP Simple HTML DOM Parser` under the [MIT License](http://opensource
Technical notes Technical notes
=== ===
* There is a cache so that source services won't ban you even if you hammer the rss-bridge with requests. Each bridge has a different duration for the cache. The `cache` subdirectory will be automatically created and cached objects older than 24 hours get purged. * There is a cache so that source services won't ban you even if you hammer the rss-bridge with requests. Each bridge can have a different duration for the cache. The `cache` subdirectory will be automatically created and cached objects older than 24 hours get purged.
* To implement a new rss-bridge, [follow the specifications](CREATE_BRIDGE.md) and take a look at existing bridges for examples. * To implement a new Bridge, [follow the specifications](https://github.com/RSS-Bridge/rss-bridge/wiki/Bridge-API) and take a look at existing Bridges for examples.
* To enable debug mode (disabling cache and enabling error reporting), create an empty file named `DEBUG` in the root directory (next to `index.php`). * To enable debug mode (disabling cache and enabling error reporting), create an empty file named `DEBUG` in the root directory (next to `index.php`).
* For more information refer to the [Wiki](https://github.com/RSS-Bridge/rss-bridge/wiki)
Rant Rant
=== ===

View file

@ -9,7 +9,7 @@ class ABCTabsBridge extends BridgeAbstract{
$this->name = "ABC Tabs Bridge"; $this->name = "ABC Tabs Bridge";
$this->uri = "http://www.abc-tabs.com/"; $this->uri = "http://www.abc-tabs.com/";
$this->description = "Returns 22 newest tabs"; $this->description = "Returns 22 newest tabs";
$this->update = "2014-07-23"; $this->update = "2016-08-09";
} }
@ -21,7 +21,7 @@ class ABCTabsBridge extends BridgeAbstract{
foreach ($table->find('tr') as $tab) foreach ($table->find('tr') as $tab)
{ {
$item = new \Item(); $item = new \Item();
$item->name = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; $item->author = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
$item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; $item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
$item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext; $item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
$item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); $item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
@ -29,20 +29,4 @@ class ABCTabsBridge extends BridgeAbstract{
$this->items[] = $item; $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
}
} }

View file

@ -7,7 +7,7 @@ class AcrimedBridge extends RssExpander{
$this->name = "Acrimed Bridge"; $this->name = "Acrimed Bridge";
$this->uri = "http://www.acrimed.org/"; $this->uri = "http://www.acrimed.org/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
} }
@ -40,18 +40,6 @@ class AcrimedBridge extends RssExpander{
} }
public function getName() {
return "Acrimed Bridge";
}
public function getURI() {
return "http://www.acrimed.org/";
}
public function getCacheDuration(){ public function getCacheDuration(){
return 4800; // 2 hours return 4800; // 2 hours
} }

View file

@ -1,57 +1,94 @@
<?php <?php
class AllocineFRBridge extends BridgeAbstract{ class AllocineFRBridge extends BridgeAbstract{
private $_URL = "http://www.allocine.fr/video/programme-12284/saison-24580/";
private $_NOM = "Faux Raccord";
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "superbaillot.net"; $this->maintainer = "superbaillot.net";
$this->name = "Allo Cine : Faux Raccord"; $this->name = "Allo Cine Bridge";
$this->uri = "http://www.allocine.fr/video/programme-12284/saison-24580/"; $this->uri = "http://www.allocine.fr";
$this->description = "Allo Cine : Faux Raccord"; $this->description = "Bridge for allocine.fr";
$this->update = "07/11/2013"; $this->update = "2016-08-10";
} $this->parameters[] =
'[
{
"name" : "category",
"identifier" : "category",
"type" : "list",
"required" : "true",
"exampleValue" : "Faux Raccord",
"title" : "Select your category",
"values" :
[
{
"name" : "Faux Raccord",
"value" : "faux-raccord"
},
{
"name" : "Top 5",
"value" : "top-5"
},
{
"name" : "Tueurs En Serie",
"value" : "tuers-en-serie"
}
]
}
]';
}
public function collectData(array $param){ public function collectData(array $params){
$html = $this->file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
// Check all parameters
if(!isset($params['category']))
$this->returnError('You must specify a valid category (&category= )!', 400);
$category = '';
switch($params['category']){
case 'faux-raccord':
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
$category = 'Faux Raccord';
break;
case 'top-5':
$this->uri = 'http://www.allocine.fr/video/programme-12299/saison-22542/';
$category = 'Top 5';
break;
case 'tuers-en-serie':
$this->uri = 'http://www.allocine.fr/video/programme-12286/saison-22938/';
$category = 'Tueurs en Séries';
break;
default:
$this->returnError('You must select a valid category!', 400);
}
// Update bridge name to match selection
$this->name .= ' : ' . $category;
$html = $this->file_get_html($this->uri) or $this->returnError("Could not request {$this->uri}!", 404);
foreach($html->find('figure.media-meta-fig') as $element) foreach($html->find('figure.media-meta-fig') as $element)
{ {
$item = new Item(); $item = new Item();
$titre = $element->find('div.titlebar h3.title a', 0); $title = $element->find('div.titlebar h3.title a', 0);
$content = trim($element->innertext); $content = trim($element->innertext);
$figCaption = strpos($content, $category);
$figCaption = strpos($content, $this->_NOM);
if($figCaption !== false) if($figCaption !== false)
{ {
$content = str_replace('src="/', 'src="http://www.allocine.fr/',$content); $content = str_replace('src="/', 'src="http://www.allocine.fr/', $content);
$content = str_replace('href="/', 'href="http://www.allocine.fr/',$content); $content = str_replace('href="/', 'href="http://www.allocine.fr/', $content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content); $content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/', $content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content); $content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/', $content);
$item->content = $content; $item->content = $content;
$item->title = trim($titre->innertext); $item->title = trim($title->innertext);
$item->uri = "http://www.allocine.fr" . $titre->href; $item->uri = "http://www.allocine.fr" . $title->href;
$this->items[] = $item; $this->items[] = $item;
} }
} }
} }
public function getName(){
return 'Allo Cine : ' . $this->_NOM;
}
public function getURI(){
return $this->_URL;
}
public function getCacheDuration(){ public function getCacheDuration(){
return 25200; // 7 hours return 25200; // 7 hours
} }
public function getDescription(){
return "Allo Cine : " . $this->_NOM . " via rss-bridge";
}
} }
?>

View file

@ -1,57 +0,0 @@
<?php
class AllocineT5Bridge extends BridgeAbstract{
private $_URL = "http://www.allocine.fr/video/programme-12299/saison-22542/";
private $_NOM = "Top 5";
public function loadMetadatas() {
$this->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 = $this->file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
foreach($html->find('figure.media-meta-fig') as $element)
{
$item = new Item();
$titre = $element->find('div.titlebar h3.title a', 0);
$content = trim($element->innertext);
$figCaption = strpos($content, $this->_NOM);
if($figCaption !== false)
{
$content = str_replace('src="/', 'src="http://www.allocine.fr/',$content);
$content = str_replace('href="/', 'href="http://www.allocine.fr/',$content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content);
$item->content = $content;
$item->title = trim($titre->innertext);
$item->uri = "http://www.allocine.fr" . $titre->href;
$this->items[] = $item;
}
}
}
public function getName(){
return 'Allo Cine : ' . $this->_NOM;
}
public function getURI(){
return $this->_URL;
}
public function getCacheDuration(){
return 25200; // 7 hours
}
public function getDescription(){
return "Allo Cine : " . $this->_NOM . " via rss-bridge";
}
}
?>

View file

@ -1,57 +0,0 @@
<?php
class AllocineTueursEnSerieBridge extends BridgeAbstract{
private $_URL = "http://www.allocine.fr/video/programme-12286/saison-22938/";
private $_NOM = "Tueurs en Séries";
public function loadMetadatas() {
$this->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 = $this->file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
foreach($html->find('figure.media-meta-fig') as $element)
{
$item = new Item();
$titre = $element->find('div.titlebar h3.title a', 0);
$content = trim($element->innertext);
$figCaption = strpos($content, $this->_NOM);
if($figCaption !== false)
{
$content = str_replace('src="/', 'src="http://www.allocine.fr/',$content);
$content = str_replace('href="/', 'href="http://www.allocine.fr/',$content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content);
$item->content = $content;
$item->title = trim($titre->innertext);
$item->uri = "http://www.allocine.fr" . $titre->href;
$this->items[] = $item;
}
}
}
public function getName(){
return 'Allo Cine : ' . $this->_NOM;
}
public function getURI(){
return $this->_URL;
}
public function getCacheDuration(){
return 25200; // 7 hours
}
public function getDescription(){
return "Allo Cine : " . $this->_NOM . " via rss-bridge";
}
}
?>

View file

@ -9,7 +9,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
$this->name = 'Anime-Ultime'; $this->name = 'Anime-Ultime';
$this->uri = 'http://www.anime-ultime.net/'; $this->uri = 'http://www.anime-ultime.net/';
$this->description = 'Returns the 10 newest releases posted on Anime-Ultime'; $this->description = 'Returns the 10 newest releases posted on Anime-Ultime';
$this->update = '2015-10-30'; $this->update = '2016-08-09';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -86,7 +86,6 @@ class AnimeUltimeBridge extends BridgeAbstract {
$item_link_element = $release->find('td', 0)->find('a', 0); $item_link_element = $release->find('td', 0)->find('a', 0);
$item_uri = $website.$item_link_element->href; $item_uri = $website.$item_link_element->href;
$item_name = html_entity_decode($item_link_element->plaintext); $item_name = html_entity_decode($item_link_element->plaintext);
$item_image = $website.substr($item_link_element->onmouseover, 37, strpos($item_link_element->onmouseover, ' ', 37) - 37);
$item_episode = html_entity_decode(str_pad($release->find('td', 1)->plaintext, 2, '0', STR_PAD_LEFT)); $item_episode = html_entity_decode(str_pad($release->find('td', 1)->plaintext, 2, '0', STR_PAD_LEFT));
$item_fansub = $release->find('td', 2)->plaintext; $item_fansub = $release->find('td', 2)->plaintext;
$item_type = $release->find('td', 4)->plaintext; $item_type = $release->find('td', 4)->plaintext;
@ -108,7 +107,6 @@ class AnimeUltimeBridge extends BridgeAbstract {
$item->title = $item_name.' '.$item_type.' '.$item_episode; $item->title = $item_name.' '.$item_type.' '.$item_episode;
$item->author = $item_fansub; $item->author = $item_fansub;
$item->timestamp = $item_date; $item->timestamp = $item_date;
$item->thumbnailUri = $item_image;
$item->content = $item_description; $item->content = $item_description;
$this->items[] = $item; $this->items[] = $item;
$processedOK++; $processedOK++;
@ -127,10 +125,6 @@ class AnimeUltimeBridge extends BridgeAbstract {
return 'Latest '.$this->filter.' - Anime-Ultime Bridge'; return 'Latest '.$this->filter.' - Anime-Ultime Bridge';
} }
public function getURI() {
return 'http://www.anime-ultime.net/';
}
public function getCacheDuration() { public function getCacheDuration() {
return 3600*3; // 3 hours return 3600*3; // 3 hours
} }

View file

@ -0,0 +1,69 @@
<?php
#ini_set('display_errors', 'On');
#error_reporting(E_ALL);
class ArstechnicaBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = "prysme";
$this->name = "ArstechnicaBridge";
$this->uri = "http://arstechnica.com";
$this->description = "The PC enthusiast's resource. Power users and the tools they love, without computing religion";
$this->update = "2016-08-09";
}
public function collectData(array $param) {
function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) {
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
#echo $url;
$html2 = file_get_html($url);
$text = $html2->find("section[id='article-guts']", 0);
/*foreach ($text->find('<aside id="social-left">') as $node)
{ $node = NULL; }*/
$text = StripWithDelimiters($text->innertext,'<aside id="social-left">','</aside>');
$text = StripWithDelimiters($text,'<figcaption class="caption">','</figcaption>');
$text = StripWithDelimiters($text,'<div class="gallery shortcode-gallery">','</div>');
//error_log("ICI", 0);
//error_log($text, 0);
return $text;
}
$html = $this->file_get_html('http://feeds.arstechnica.com/arstechnica/index') or $this->returnError('Could not request NextInpact.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext);
$item->author = StripCDATA($element->find('author', 0)->innertext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri);
//$item->content = $item->uri;
$this->items[] = $item;
$limit++;
}
}
}
public function getCacheDuration() {
return 7200; // 2h
}
}

View file

@ -7,7 +7,7 @@ class Arte7Bridge extends BridgeAbstract{
$this->name = "Arte +7"; $this->name = "Arte +7";
$this->uri = "http://www.arte.tv/"; $this->uri = "http://www.arte.tv/";
$this->description = "Returns newest videos from ARTE +7"; $this->description = "Returns newest videos from ARTE +7";
$this->update = "2015-10-31"; $this->update = "2016-08-09";
$this->parameters["Catégorie (Français)"] = $this->parameters["Catégorie (Français)"] =
'[ '[
{ {
@ -147,24 +147,15 @@ class Arte7Bridge extends BridgeAbstract{
$hack_broadcast_time = strtok($hack_broadcast_time, 'T'); $hack_broadcast_time = strtok($hack_broadcast_time, 'T');
$hack_broadcast_time = strtok('T'); $hack_broadcast_time = strtok('T');
$item->timestamp = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time); $item->timestamp = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time);
$item->thumbnailUri = $element['thumbnail_url'];
$item->title = $element['title']; $item->title = $element['title'];
if (!empty($element['subtitle'])) if (!empty($element['subtitle']))
$item->title = $element['title'].' | '.$element['subtitle']; $item->title = $element['title'].' | '.$element['subtitle'];
$item->duration = round((int)$element['duration']/60); $item->duration = round((int)$element['duration']/60);
$item->content = $element['teaser'].'<br><br>'.$item->duration.'min<br><a href="'.$item->uri.'"><img src="' . $item->thumbnailUri . '" /></a>'; $item->content = $element['teaser'].'<br><br>'.$item->duration.'min<br><a href="'.$item->uri.'"><img src="' . $element['thumbnail_url'] . '" /></a>';
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Arte7';
}
public function getURI(){
return 'http://www.arte.tv/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -9,7 +9,7 @@ class BandcampBridge extends BridgeAbstract{
$this->name = "Bandcamp Tag"; $this->name = "Bandcamp Tag";
$this->uri = "http://bandcamp.com/"; $this->uri = "http://bandcamp.com/";
$this->description = "New bandcamp release by tag"; $this->description = "New bandcamp release by tag";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -38,7 +38,7 @@ class BandcampBridge extends BridgeAbstract{
$uri = rtrim($uri, "')"); $uri = rtrim($uri, "')");
$item = new \Item(); $item = new \Item();
$item->name = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; $item->author = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item->title = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; $item->title = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item->content = '<img src="' . $uri . '"/><br/>' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; $item->content = '<img src="' . $uri . '"/><br/>' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item->id = $release->find('a',0)->getAttribute('href'); $item->id = $release->find('a',0)->getAttribute('href');
@ -51,10 +51,6 @@ class BandcampBridge extends BridgeAbstract{
return (!empty($this->request) ? $this->request .' - ' : '') .'Bandcamp Tag'; return (!empty($this->request) ? $this->request .' - ' : '') .'Bandcamp Tag';
} }
public function getURI(){
return 'http://bandcamp.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 600; // 10 minutes return 600; // 10 minutes
} }

View file

@ -1,52 +1,37 @@
<?php <?php
class BastaBridge extends BridgeAbstract{ class BastaBridge extends BridgeAbstract{
public function loadMetadatas() {
public function loadMetadatas() { $this->maintainer = "qwertygc";
$this->name = "Bastamag Bridge";
$this->maintainer = "qwertygc"; $this->uri = "http://www.bastamag.net/";
$this->name = "Bastamag Bridge"; $this->description = "Returns the newest articles.";
$this->uri = "http://www.bastamag.net/"; $this->update = "2016-08-09";
$this->description = "Returns the newest articles."; }
$this->update = "2014-05-25";
public function collectData(array $param){
} // Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'!
function ReplaceImageUrl($content){
return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\'http://www.bastamag.net/$1\'', $content);
public function collectData(array $param){
function BastaExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.texte', 0)->innertext;
return $text;
} }
$html = $this->file_get_html('http://www.bastamag.net/spip.php?page=backend') or $this->returnError('Could not request Bastamag.', 404); $html = $this->file_get_html('http://www.bastamag.net/spip.php?page=backend') or $this->returnError('Could not request Bastamag.', 404);
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 10) { if($limit < 10) {
$item = new \Item(); $item = new \Item();
$item->title = $element->find('title', 0)->innertext; $item->title = $element->find('title', 0)->innertext;
$item->uri = $element->find('guid', 0)->plaintext; $item->uri = $element->find('guid', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('dc:date', 0)->plaintext);
$item->content = BastaExtractContent($item->uri); $item->content = ReplaceImageUrl($this->file_get_html($item->uri)->find('div.texte', 0)->innertext);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }
} }
}
}
public function getName(){ public function getCacheDuration(){
return 'Bastamag Bridge'; return 3600*2; // 2 hours
} }
public function getURI(){
return 'http://bastamag.net/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
// return 0; // 2 hours
}
} }
?>

View file

@ -7,7 +7,7 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
$this->name = "Blagues De Merde"; $this->name = "Blagues De Merde";
$this->uri = "http://www.blaguesdemerde.fr/"; $this->uri = "http://www.blaguesdemerde.fr/";
$this->description = "Blagues De Merde"; $this->description = "Blagues De Merde";
$this->update = "16/10/2013"; $this->update = "2016-08-09";
} }
@ -26,25 +26,14 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
$date = $element->find("li.bdm_date",0)->innertext; $date = $element->find("li.bdm_date",0)->innertext;
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4)); $time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
$item->timestamp = $time; $item->timestamp = $time;
$item->name = $element->find("li.bdm_pseudo",0)->innertext;; $item->author = $element->find("li.bdm_pseudo",0)->innertext;;
$this->items[] = $item; $this->items[] = $item;
} }
} }
} }
public function getName(){
return 'blaguesdemerde';
}
public function getURI(){
return 'http://www.blaguesdemerde.fr/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 7200; // 2h hours return 7200; // 2h hours
} }
public function getDescription(){
return "Blagues De Merde via rss-bridge";
}
} }
?> ?>

View file

@ -7,7 +7,7 @@ class BooruprojectBridge extends BridgeAbstract{
$this->name = "Booruproject"; $this->name = "Booruproject";
$this->uri = "http://booru.org/"; $this->uri = "http://booru.org/";
$this->description = "Returns images from given page and booruproject instance (****.booru.org)"; $this->description = "Returns images from given page and booruproject instance (****.booru.org)";
$this->update = "2015-09-12"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -51,22 +51,13 @@ class BooruprojectBridge extends BridgeAbstract{
$item->uri = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href; $item->uri = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id')); $item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
$item->timestamp = time(); $item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('title'); $item->tags = $element->find('img', 0)->getAttribute('title');
$item->title = 'Booruproject '.$param['i'].' | '.$item->postid; $item->title = 'Booruproject '.$param['i'].' | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags; $item->content = '<a href="' . $item->uri . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Booruproject';
}
public function getURI(){
return 'http://booru.org/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -1,69 +1,70 @@
<?php <?php
class CADBridge extends BridgeAbstract{ class CADBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "nyutag";
$this->name = "CAD Bridge";
$this->uri = "http://www.cad-comic.com/";
$this->description = "Returns the newest articles.";
$this->update = "2016-08-09";
}
public function loadMetadatas() { private function CADExtractContent($url) {
$this->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) {
$html2 = explode("\"", $string);
$string = $html2[1];
if (substr($string,0,4) != 'http')
return 'notanurl';
return $string;
}
function CADExtractContent($url) {
$html3 = $this->file_get_html($url); $html3 = $this->file_get_html($url);
// The request might fail due to missing https support or wrong URL
if($html3 == false)
return 'Daily comic not released yet';
$htmlpart = explode("/", $url); $htmlpart = explode("/", $url);
if ($htmlpart[3] == 'cad')
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2); switch ($htmlpart[3]){
if ($htmlpart[3] == 'sillies') case 'cad':
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/sillies-\S*gif/", $html3, $url2); preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2);
break;
case 'sillies':
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/sillies-\S*gif/", $html3, $url2);
break;
default:
return 'Daily comic not released yet';
}
$img = implode ($url2[0]); $img = implode ($url2[0]);
$html3->clear(); $html3->clear();
unset ($html3); unset ($html3);
if ($img == '') if ($img == '')
return 'Daily comic not realease yet'; return 'Daily comic not released yet';
return '<img src="'.$img.'"/>'; return '<img src="'.$img.'"/>';
}
public function collectData(array $param){
function CADUrl($string) {
$html2 = explode("\"", $string);
$string = $html2[1];
if (substr($string,0,4) != 'http')
return 'notanurl';
return $string;
} }
$html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnError('Could not request CAD.', 404); $html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnError('Could not request CAD.', 404);
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = new \Item();
$item->title = $element->find('title', 0)->innertext; $item->title = $element->find('title', 0)->innertext;
$item->uri = CADUrl($element->find('description', 0)->innertext); $item->uri = CADUrl($element->find('description', 0)->innertext);
if ($item->uri != 'notanurl') { if ($item->uri != 'notanurl') {
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = CADExtractContent($item->uri); $item->content = $this->CADExtractContent($item->uri);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }
} }
} }
}
}
public function getName(){ public function getCacheDuration(){
return 'CAD Bridge'; return 3600*2; // 2 hours
} }
public function getURI(){
return 'http://www.cad-comic.com/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
// return 0;
}
} }
?>

View file

@ -9,7 +9,7 @@ class CNETBridge extends BridgeAbstract {
$this->name = 'CNET News'; $this->name = 'CNET News';
$this->uri = 'http://www.cnet.com/'; $this->uri = 'http://www.cnet.com/';
$this->description = 'Returns the newest articles. <br /> You may specify a topic found in some section URLs, else all topics are selected.'; $this->description = 'Returns the newest articles. <br /> You may specify a topic found in some section URLs, else all topics are selected.';
$this->update = '2016-03-16'; $this->update = '2016-08-09';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -59,7 +59,6 @@ class CNETBridge extends BridgeAbstract {
$article_title = trim($element->find('h2', 0)->plaintext); $article_title = trim($element->find('h2', 0)->plaintext);
$article_uri = 'http://www.cnet.com'.($element->find('a', 0)->href); $article_uri = 'http://www.cnet.com'.($element->find('a', 0)->href);
$article_thumbnail = $element->parent()->find('img', 0)->src;
$article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext); $article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext);
$article_author = trim($element->find('a[rel=author]', 0)->plaintext); $article_author = trim($element->find('a[rel=author]', 0)->plaintext);
@ -67,20 +66,10 @@ class CNETBridge extends BridgeAbstract {
$article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request CNET: '.$article_uri, 500); $article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request CNET: '.$article_uri, 500);
if (is_null($article_thumbnail))
$article_thumbnail = $article_html->find('div.originalImage', 0);
if (is_null($article_thumbnail))
$article_thumbnail = $article_html->find('span.imageContainer', 0);
if (is_object($article_thumbnail))
$article_thumbnail = $article_thumbnail->find('img', 0)->src;
$article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>'))); $article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>')));
$item = new \Item(); $item = new \Item();
$item->uri = $article_uri; $item->uri = $article_uri;
$item->thumbnailUri = $article_thumbnail;
$item->title = $article_title; $item->title = $article_title;
$item->author = $article_author; $item->author = $article_author;
$item->timestamp = $article_timestamp; $item->timestamp = $article_timestamp;
@ -96,12 +85,7 @@ class CNETBridge extends BridgeAbstract {
return 'CNET News Bridge'.(empty($this->topicName) ? '' : ' - '.$this->topicName); return 'CNET News Bridge'.(empty($this->topicName) ? '' : ' - '.$this->topicName);
} }
public function getURI() {
return 'http://www.cnet.com/';
}
public function getCacheDuration() { public function getCacheDuration() {
return 1800; // 30 minutes return 1800; // 30 minutes
// return 0;
} }
} }

122
bridges/CastorusBridge.php Normal file
View file

@ -0,0 +1,122 @@
<?php
class CastorusBridge extends BridgeAbstract {
public function loadMetadatas(){
$this->maintainer = "logmanoriginal";
$this->name = "Castorus Bridge";
$this->uri = 'http://www.castorus.com';
$this->description = "Returns the latest changes";
$this->update = "2016-08-09";
$this->parameters["Get latest changes"] = '[]';
$this->parameters["Get latest changes via ZIP code"] =
'[
{
"name": "ZIP code",
"identifier" : "zip",
"type" : "text",
"required" : "true",
"exampleValue" : "74910, 74",
"title" : "Insert ZIP code (complete or partial)"
}
]';
$this->parameters["Get latest changes via city name"] =
'[
{
"name": "City name",
"identifier" : "city",
"type" : "text",
"required" : "true",
"exampleValue" : "Seyssel, Seys",
"title" : "Insert city name (complete or partial)"
}
]';
}
// Extracts the tile from an actitiy
private function ExtractActivityTitle($activity){
$title = $activity->find('a', 0);
if(!$title)
$this->returnError('Cannot find title!', 404);
return htmlspecialchars(trim($title->plaintext));
}
// Extracts the url from an actitiy
private function ExtractActivityUrl($activity){
$url = $activity->find('a', 0);
if(!$url)
$this->returnError('Cannot find url!', 404);
return $this->uri . $url->href;
}
// Extracts the time from an activity
private function ExtractActivityTime($activity){
// Unfortunately the time is part of the parent node,
// so we have to clear all child nodes first
$nodes = $activity->find('*');
if(!$nodes)
$this->returnError('Cannot find nodes!', 404);
foreach($nodes as $node){
$node->outertext = '';
}
return strtotime($activity->innertext);
}
// Extracts the price change
private function ExtractActivityPrice($activity){
$price = $activity->find('span', 1);
if(!$price)
$this->returnError('Cannot find price!', 404);
return $price->innertext;
}
public function collectData(array $params){
if(isset($params['zip']))
$zip_filter = trim($params['zip']);
if(isset($params['city']))
$city_filter = trim($params['city']);
$html = $this->file_get_html($this->uri);
if(!$html)
$this->returnError('Could not load data from ' . $this->uri . '!', 404);
$activities = $html->find('div#activite/li');
if(!$activities)
$this->returnError('Failed to find activities!', 404);
foreach($activities as $activity){
$item = new \Item();
$item->title = $this->ExtractActivityTitle($activity);
$item->uri = $this->ExtractActivityUrl($activity);
$item->timestamp = $this->ExtractActivityTime($activity);
$item->content = '<a href="' . $item->uri . '">' . $item->title . '</a><br><p>'
. $this->ExtractActivityPrice($activity) . '</p>';
if(isset($zip_filter) && !(substr($item->title, 0, strlen($zip_filter)) === $zip_filter)){
continue; // Skip this item
}
if(isset($city_filter) && !(substr($item->title, strpos($item->title, ' ') + 1, strlen($city_filter)) === $city_filter)){
continue; // Skip this item
}
$this->items[] = $item;
}
}
public function getCacheDuration(){
return 600; // 10 minutes
}
}

View file

@ -1,56 +0,0 @@
<?php
class CoinDeskBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function CoinDeskExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.single-content', 0)->innertext;
$text = strip_tags($text, '<p><a><img>');
return $text;
}
$html = $this->file_get_html('http://www.coindesk.com/feed/atom/') or $this->returnError('Could not request CoinDesk.', 404);
$limit = 0;
foreach($html->find('entry') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = CoinDeskStripCDATA($element->find('title', 0)->innertext);
$item->author = $element->find('author', 0)->plaintext;
$item->uri = $element->find('link', 0)->href;
$item->timestamp = strtotime($element->find('published', 0)->plaintext);
$item->content = CoinDeskExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'CoinDesk';
}
public function getURI(){
return 'http://www.coindesk.com/';
}
public function getCacheDuration(){
return 1800; // 30min
}
}

View file

@ -6,7 +6,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{
$this->name = "CollegeDeFrance"; $this->name = "CollegeDeFrance";
$this->uri = "http://www.college-de-france.fr/"; $this->uri = "http://www.college-de-france.fr/";
$this->description = "Returns the latest audio and video from CollegeDeFrance"; $this->description = "Returns the latest audio and video from CollegeDeFrance";
$this->update = "2016-05-01"; $this->update = "2016-08-09";
} }
public function collectData(array $param) { public function collectData(array $param) {
@ -54,14 +54,6 @@ class CollegeDeFranceBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'CollegeDeFrance';
}
public function getURI(){
return 'http://www.college-de-france.fr/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 3600*3; // 3 hours return 3600*3; // 3 hours
} }

View file

@ -1,58 +1,42 @@
<?php <?php
class CommonDreamsBridge extends BridgeAbstract{ class CommonDreamsBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "nyutag";
$this->name = "CommonDreams Bridge";
$this->uri = "http://www.commondreams.org/";
$this->description = "Returns the newest articles.";
$this->update = "2016-08-09";
}
$this->maintainer = "nyutag"; private function CommonDreamsExtractContent($url) {
$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) {
$html2 = explode(" ", $string);
$string = $html2[2] . "/node/" . $html2[0];
return $string;
}
function CommonDreamsExtractContent($url) {
$html3 = $this->file_get_html($url); $html3 = $this->file_get_html($url);
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext; $text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
$html3->clear(); $html3->clear();
unset ($html3); unset ($html3);
return $text; return $text;
}
public function collectData(array $param){
function CommonDreamsUrl($string) {
$html2 = explode(" ", $string);
$string = $html2[2] . "/node/" . $html2[0];
return $string;
} }
$html = $this->file_get_html('http://www.commondreams.org/rss.xml') or $this->returnError('Could not request CommonDreams.', 404); $html = $this->file_get_html('http://www.commondreams.org/rss.xml') or $this->returnError('Could not request CommonDreams.', 404);
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 4) { if($limit < 4) {
$item = new \Item(); $item = new \Item();
$item->title = $element->find('title', 0)->innertext; $item->title = $element->find('title', 0)->innertext;
$item->uri = CommonDreamsUrl($element->find('guid', 0)->innertext); $item->uri = CommonDreamsUrl($element->find('guid', 0)->innertext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = CommonDreamsExtractContent($item->uri); $item->content = $this->CommonDreamsExtractContent($item->uri);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }
} }
}
}
public function getName(){
return 'CommonDreams Bridge';
}
public function getURI(){
return 'http://www.commondreams.org/';
}
public function getCacheDuration(){
return 3600; // 1 hours
// return 0;
}
} }

View file

@ -7,7 +7,7 @@ class CopieDoubleBridge extends BridgeAbstract{
$this->name = "CopieDouble"; $this->name = "CopieDouble";
$this->uri = "http://www.copie-double.com/"; $this->uri = "http://www.copie-double.com/";
$this->description = "CopieDouble"; $this->description = "CopieDouble";
$this->update = "12/12/2013"; $this->update = "2016-08-09";
} }
@ -42,21 +42,7 @@ class CopieDoubleBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'CopieDouble';
}
public function getURI(){
return 'http://www.copie-double.com';
}
public function getDescription(){
return 'CopieDouble via rss-bridge';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 14400; // 4 hours return 14400; // 4 hours
} }
} }
?>

View file

@ -4,10 +4,10 @@ class CourrierInternationalBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "teromene"; $this->maintainer = "teromene";
$this->name = "CourrierInternational"; $this->name = "Courrier International Bridge";
$this->uri = "http://CourrierInternational.fr/"; $this->uri = "http://CourrierInternational.fr/";
$this->description = "Courrier International bridge"; $this->description = "Courrier International bridge";
$this->update = "01/09/2015"; $this->update = "2016-08-09";
} }
@ -61,14 +61,6 @@ class CourrierInternationalBridge extends BridgeAbstract{
} }
public function getName(){
return 'Courrier International Bridge';
}
public function getURI(){
return 'http://courrierinternational.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 300; // 5 minutes return 300; // 5 minutes
} }

View file

@ -24,7 +24,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$this->name = "Cpasbien Bridge"; $this->name = "Cpasbien Bridge";
$this->uri = "http://www.cpasbien.io"; $this->uri = "http://www.cpasbien.io";
$this->description = "Returns latest torrents from a request query"; $this->description = "Returns latest torrents from a request query";
$this->update = "2016-01-26"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -57,7 +57,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$htmlepisode=content_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href'))); $htmlepisode=content_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href')));
$item = new \Item(); $item = new \Item();
$item->name = $episode->find('a', 0)->text(); $item->author = $episode->find('a', 0)->text();
$item->title = $episode->find('a', 0)->text(); $item->title = $episode->find('a', 0)->text();
$item->timestamp = $this->get_cached_time($episode->find('a', 0)->getAttribute('href')); $item->timestamp = $this->get_cached_time($episode->find('a', 0)->getAttribute('href'));
$textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1); $textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1);
@ -70,7 +70,6 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$item->id = $episode->find('a', 0)->getAttribute('href'); $item->id = $episode->find('a', 0)->getAttribute('href');
$item->uri = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href'); $item->uri = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href');
$item->thumbnailUri = $htmlepisode->find('#bigcover', 0)->find('img',0)->getAttribute('src');
$this->items[] = $item; $this->items[] = $item;
} }
} }
@ -83,10 +82,6 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
return (!empty($this->request) ? $this->request .' - ' : '') . $this->name; return (!empty($this->request) ? $this->request .' - ' : '') . $this->name;
} }
public function getURI(){
return $this->uri;
}
public function getCacheDuration(){ public function getCacheDuration(){
return 60*60*24; // 24 hours return 60*60*24; // 24 hours
} }

View file

@ -7,7 +7,7 @@ class CryptomeBridge extends BridgeAbstract{
$this->name = "Cryptome"; $this->name = "Cryptome";
$this->uri = "http://cryptome.org/"; $this->uri = "http://cryptome.org/";
$this->description = "Returns the N most recent documents."; $this->description = "Returns the N most recent documents.";
$this->update = ""; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -46,14 +46,6 @@ class CryptomeBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'Cryptome';
}
public function getURI(){
return 'https://secure.netsolhost.com/cryptome.org/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -9,7 +9,7 @@ class DailymotionBridge extends BridgeAbstract{
$this->name = "Dailymotion Bridge"; $this->name = "Dailymotion Bridge";
$this->uri = "https://www.dailymotion.com/"; $this->uri = "https://www.dailymotion.com/";
$this->description = "Returns the 5 newest videos by username/playlist or search"; $this->description = "Returns the 5 newest videos by username/playlist or search";
$this->update = "2014-11-18"; $this->update = "2016-08-09";
$this->parameters["By username"] = $this->parameters["By username"] =
'[ '[
@ -24,7 +24,7 @@ class DailymotionBridge extends BridgeAbstract{
{ {
"name" : "playlist id", "name" : "playlist id",
"identifier" : "p", "identifier" : "p",
"type" : "number" "type" : "text"
} }
]'; ]';
@ -47,7 +47,7 @@ class DailymotionBridge extends BridgeAbstract{
function getMetadata($id) { function getMetadata($id) {
$metadata=array(); $metadata=array();
$html2 = $this->file_get_html('http://www.dailymotion.com/video/'.$id) or $this->returnError('Could not request Dailymotion.', 404); $html2 = file_get_html('http://www.dailymotion.com/video/'.$id) or $this->returnError('Could not request Dailymotion.', 404);
$metadata['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content'); $metadata['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content');
$metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 0)->getAttribute('content') ); $metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 0)->getAttribute('content') );
$metadata['thumbnailUri'] = $html2->find('meta[property=og:image]', 0)->getAttribute('content'); $metadata['thumbnailUri'] = $html2->find('meta[property=og:image]', 0)->getAttribute('content');
@ -83,10 +83,9 @@ class DailymotionBridge extends BridgeAbstract{
$item->id = str_replace('/video/', '', strtok($element->href, '_')); $item->id = str_replace('/video/', '', strtok($element->href, '_'));
$metadata = getMetadata($item->id); $metadata = getMetadata($item->id);
$item->uri = $metadata['uri']; $item->uri = $metadata['uri'];
$item->thumbnailUri = $metadata['thumbnailUri'];
$item->title = $metadata['title']; $item->title = $metadata['title'];
$item->timestamp = $metadata['timestamp']; $item->timestamp = $metadata['timestamp'];
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br><a href="' . $item->uri . '">' . $item->title . '</a>'; $item->content = '<a href="' . $item->uri . '"><img src="' . $metadata['thumbnailUri'] . '" /></a><br><a href="' . $item->uri . '">' . $item->title . '</a>';
$this->items[] = $item; $this->items[] = $item;
$count++; $count++;
} }
@ -97,10 +96,6 @@ class DailymotionBridge extends BridgeAbstract{
return (!empty($this->request) ? $this->request .' - ' : '') .'Dailymotion Bridge'; return (!empty($this->request) ? $this->request .' - ' : '') .'Dailymotion Bridge';
} }
public function getURI(){
return 'https://www.dailymotion.com/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 3600*3; // 3 hours return 3600*3; // 3 hours
} }

View file

@ -7,7 +7,7 @@ class DanbooruBridge extends BridgeAbstract{
$this->name = "Danbooru"; $this->name = "Danbooru";
$this->uri = "http://donmai.us/"; $this->uri = "http://donmai.us/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -37,22 +37,14 @@ class DanbooruBridge extends BridgeAbstract{
$item->uri = 'http://donmai.us'.$element->find('a', 0)->href; $item->uri = 'http://donmai.us'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id')); $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id'));
$item->timestamp = time(); $item->timestamp = time();
$item->thumbnailUri = 'http://donmai.us'.$element->find('img', 0)->src; $thumbnailUri = 'http://donmai.us'.$element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt'); $item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Danbooru | '.$item->postid; $item->title = 'Danbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags; $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Danbooru';
}
public function getURI(){
return 'http://donmai.us/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -5,9 +5,9 @@ class DansTonChatBridge extends BridgeAbstract{
$this->maintainer = "Astalaseven"; $this->maintainer = "Astalaseven";
$this->name = "DansTonChat Bridge"; $this->name = "DansTonChat Bridge";
$this->uri = "http://danstonchat.com/latest.html"; $this->uri = "http://danstonchat.com";
$this->description = "Returns latest quotes from DansTonChat."; $this->description = "Returns latest quotes from DansTonChat.";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
} }
@ -26,14 +26,6 @@ class DansTonChatBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'DansTonChat';
}
public function getURI(){
return 'http://danstonchat.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -1,130 +1,129 @@
<?php <?php
class DauphineLibereBridge extends BridgeAbstract{ class DauphineLibereBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "qwertygc"; $this->maintainer = "qwertygc";
$this->name = "DauphineLibereBridge Bridge"; $this->name = "Dauphine Bridge";
$this->uri = "http://www.ledauphine.com/"; $this->uri = "http://www.ledauphine.com/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "05/11/2015"; $this->update = "2016-08-09";
$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"
}
]
}
]';
}
$this->parameters[] = private function ExtractContent($url, $context) {
'[ $html2 = $this->file_get_html($url, false, $context);
{
"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){
function ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.column', 0)->innertext; $text = $html2->find('div.column', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
return $text; return $text;
} }
public function collectData(array $param){
// Simulate Mozilla user-agent to fix error 403 (Forbidden)
$opts = array('http' =>
array(
'method' => 'GET',
'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
)
);
$context = stream_context_create($opts);
if (isset($param['u'])) { /* user timeline mode */ if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u']; $this->request = $param['u'];
$html = $this->file_get_html('http://www.ledauphine.com/'.$this->request.'/rss') or $this->returnError('Could not request DauphineLibere.', 404); $html = $this->file_get_html('http://www.ledauphine.com/'.$this->request.'/rss', false, $context) or $this->returnError('Could not request DauphineLibere.', 404);
} }
else { else {
$html = $this->file_get_html('http://www.ledauphine.com/rss') or $this->returnError('Could not request DauphineLibere.', 404); $html = $this->file_get_html('http://www.ledauphine.com/rss', false, $context) or $this->returnError('Could not request DauphineLibere.', 404);
} }
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 10) { if($limit < 10) {
$item = new \Item(); $item = new \Item();
$item->title = $element->find('title', 0)->innertext; $item->title = $element->find('title', 0)->innertext;
$item->uri = $element->find('guid', 0)->plaintext; $item->uri = $element->find('guid', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri); $item->content = $this->ExtractContent($item->uri, $context);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }
} }
}
}
public function getName(){ public function getCacheDuration(){
return 'Dauphine Bridge'; return 3600*2; // 2 hours
} }
public function getURI(){
return 'http://ledauphine.com/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
// return 0; // 2 hours
}
} }
?>

View file

@ -7,7 +7,7 @@ class DemoBridge extends BridgeAbstract{
$this->name = "DemoBridge"; $this->name = "DemoBridge";
$this->uri = "http://github.com/sebsauvage/rss-bridge"; $this->uri = "http://github.com/sebsauvage/rss-bridge";
$this->description = "Bridge used for demos"; $this->description = "Bridge used for demos";
$this->update = "2015-11-03"; $this->update = "2016-08-09";
$this->parameters['testCheckbox'] = $this->parameters['testCheckbox'] =
'[ '[
@ -54,29 +54,16 @@ class DemoBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$item = new \Item(); $item = new \Item();
$item->name = "TestElement"; $item->author = "Me!";
$item->title = "Test"; $item->title = "Test";
$item->content = "Awesome content !"; $item->content = "Awesome content !";
$item->id = "Lalala"; $item->id = "Lalala";
$item->uri = "http://test.test/test"; $item->uri = "http://test.test/test";
$item->enclosures[] = "http://www.ardmediathek.de/ard/servlet/image/00/32/68/18/38/1135274624/16x9/960";
$this->items[] = $item; $this->items[] = $item;
} }
public function getName() {
return "DemoBridge";
}
public function getURI() {
return "http://github.com/sebsauvage/rss-bridge";
}
public function getCacheDuration(){ public function getCacheDuration(){
return 00; // 1 hour return 00; // 1 hour
} }

View file

@ -2,74 +2,64 @@
class DeveloppezDotComBridge extends BridgeAbstract{ class DeveloppezDotComBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "polopollo"; $this->maintainer = "polopollo";
$this->name = "Developpez.com Actus (FR)"; $this->name = "Developpez.com Actus (FR)";
$this->uri = "http://www.developpez.com/"; $this->uri = "http://www.developpez.com/";
$this->description = "Returns the 15 newest posts from DeveloppezDotCom (full text)."; $this->description = "Returns the 15 newest posts from DeveloppezDotCom (full text).";
$this->update = "2014-07-14"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function DeveloppezDotComStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function DeveloppezDotComStripCDATA($string) { // F***ing quotes from Microsoft Word badly encoded, here was the trick:
$string = str_replace('<![CDATA[', '', $string); // http://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php
$string = str_replace(']]>', '', $string); private function convert_smart_quotes($string)
return $string; {
} $search = array(chr(145),
chr(146),
chr(147),
chr(148),
chr(151));
function convert_smart_quotes($string)//F***ing quotes from Microsoft Word badly encoded, here was the trick: http://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php $replace = array("'",
{ "'",
$search = array(chr(145), '"',
chr(146), '"',
chr(147), '-');
chr(148),
chr(151));
$replace = array("'", return str_replace($search, $replace, $string);
"'", }
'"',
'"',
'-');
return str_replace($search, $replace, $string); private function DeveloppezDotComExtractContent($url) {
} $articleHTMLContent = $this->file_get_html($url);
$text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
$text = utf8_encode($text);
return trim($text);
}
function DeveloppezDotComExtractContent($url) { public function collectData(array $param){
$articleHTMLContent = $this->file_get_html($url); $rssFeed = $this->file_get_html('http://www.developpez.com/index/rss') or $this->returnError('Could not request http://www.developpez.com/index/rss', 404);
$text = convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext); $limit = 0;
$text = utf8_encode($text);
return trim($text);
}
$rssFeed = $this->file_get_html('http://www.developpez.com/index/rss') or $this->returnError('Could not request http://www.developpez.com/index/rss', 404); foreach($rssFeed->find('item') as $element) {
$limit = 0; if($limit < 10) {
$item = new \Item();
$item->title = $this->DeveloppezDotComStripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->DeveloppezDotComStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$content = $this->DeveloppezDotComExtractContent($item->uri);
$item->content = strlen($content) ? $content : $element->description; //In case of it is a tutorial, we just keep the original description
$this->items[] = $item;
$limit++;
}
}
}
foreach($rssFeed->find('item') as $element) { public function getCacheDuration(){
if($limit < 10) { return 1800; // 30min
$item = new \Item(); }
$item->title = DeveloppezDotComStripCDATA($element->find('title', 0)->innertext);
$item->uri = DeveloppezDotComStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$content = DeveloppezDotComExtractContent($item->uri);
$item->content = strlen($content) ? $content : $element->description;//In case of it is a tutorial, we just keep the original description
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'DeveloppezDotCom';
}
public function getURI(){
return 'http://www.developpez.com/';
}
public function getCacheDuration(){
return 1800; // 30min
}
} }

View file

@ -4,10 +4,10 @@ class DilbertBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = 'kranack'; $this->maintainer = 'kranack';
$this->name = $this->getName(); $this->name = 'Dilbert Daily Strip';
$this->uri = $this->getURI(); $this->uri = 'http://dilbert.com';
$this->description = $this->getDescription(); $this->description = 'The Unofficial Dilbert Daily Comic Strip';
$this->update = "14/05/2016"; $this->update = "2016-08-09";
} }
@ -29,7 +29,6 @@ class DilbertBridge extends BridgeAbstract {
$item = new \Item(); $item = new \Item();
$item->uri = $url; $item->uri = $url;
$item->thumbnailUri = $comic;
$item->title = $title; $item->title = $title;
$item->author = 'Scott Adams'; $item->author = 'Scott Adams';
$item->timestamp = $date; $item->timestamp = $date;
@ -38,18 +37,6 @@ class DilbertBridge extends BridgeAbstract {
} }
} }
public function getName() {
return 'Dilbert Daily Strip';
}
public function getURI() {
return 'http://dilbert.com';
}
public function getDescription() {
return 'The Unofficial Dilbert Daily Comic Strip';
}
public function getCacheDuration() { public function getCacheDuration() {
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -7,7 +7,7 @@ class DollbooruBridge extends BridgeAbstract{
$this->name = "Dollbooru"; $this->name = "Dollbooru";
$this->uri = "http://dollbooru.org/"; $this->uri = "http://dollbooru.org/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2015-01-20"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
@ -40,22 +40,14 @@ class DollbooruBridge extends BridgeAbstract{
$item->uri = 'http://dollbooru.org'.$element->href; $item->uri = 'http://dollbooru.org'.$element->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id')); $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id'));
$item->timestamp = time(); $item->timestamp = time();
$item->thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->src; $thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->src;
$item->tags = $element->getAttribute('data-tags'); $item->tags = $element->getAttribute('data-tags');
$item->title = 'Dollbooru | '.$item->postid; $item->title = 'Dollbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags; $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Dollbooru';
}
public function getURI(){
return 'http://dollbooru.org/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -7,7 +7,7 @@ class DuckDuckGoBridge extends BridgeAbstract{
$this->name = "DuckDuckGo"; $this->name = "DuckDuckGo";
$this->uri = "https://duckduckgo.com/"; $this->uri = "https://duckduckgo.com/";
$this->description = "Returns most recent results from DuckDuckGo."; $this->description = "Returns most recent results from DuckDuckGo.";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -33,14 +33,6 @@ class DuckDuckGoBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'DuckDuckGo';
}
public function getURI(){
return 'https://duckduckgo.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -7,7 +7,7 @@ class EZTVBridge extends BridgeAbstract{
$this->name = "EZTV"; $this->name = "EZTV";
$this->uri = "https://eztv.ch/"; $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->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->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -72,16 +72,4 @@ class EZTVBridge extends BridgeAbstract{
} }
} }
} }
public function getName(){
return 'EZTV';
}
public function getURI(){
return 'https://eztv.ch/';
}
public function getCacheDuration(){
return 3600; // 1 hour
}
} }

View file

@ -8,7 +8,7 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
$this->name = "Elite: Dangerous Galnet"; $this->name = "Elite: Dangerous Galnet";
$this->uri = "https://community.elitedangerous.com/galnet"; $this->uri = "https://community.elitedangerous.com/galnet";
$this->description = "Returns the latest page of news from Galnet"; $this->description = "Returns the latest page of news from Galnet";
$this->update = "2016-04-06"; $this->update = "2016-08-09";
} }
public function collectData(array $param) public function collectData(array $param)
@ -36,16 +36,6 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
} }
} }
public function getName()
{
return 'Elite: Dangerous Galnet';
}
public function getURI()
{
return 'https://community.elitedangerous.com/galnet';
}
public function getCacheDuration() public function getCacheDuration()
{ {
return 3600 * 2; // 2 hours return 3600 * 2; // 2 hours

View file

@ -1,55 +1,83 @@
<?php <?php
/**
* ElsevierBridge
*
* @name Elsevier Bridge
* @description Returns the recent articles published in Elsevier journals
*/
class ElsevierBridge extends BridgeAbstract{ class ElsevierBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = 'Pierre Mazière'; $this->maintainer = 'Pierre Mazière';
$this->name = 'Elsevier journals recent articles'; $this->name = 'Elsevier journals recent articles';
$this->uri = 'http://www.journals.elsevier.com'; $this->uri = 'http://www.journals.elsevier.com';
$this->description = 'Returns the recent articles published in Elsevier journals'; $this->description = 'Returns the recent articles published in Elsevier journals';
$this->update = '2016-06-26'; $this->update = '2016-08-09';
$this->parameters= $this->parameters[] =
'[ '[
{ {
"name" : "Journal name", "name" : "Journal name",
"identifier" : "j" "identifier" : "j",
} "required" : "true",
]'; "exampleValue" : "academic-pediatrics",
} "title" : "Insert html-part of your journal"
}
]';
}
public function collectData(array $param){ // Extracts the list of names from an article as string
$uri = 'http://www.journals.elsevier.com/'.$param['j'].'/recent-articles/'; private function ExtractArticleName ($article){
$html = file_get_html($uri) $names = $article->find('small', 0);
or $this->returnError('No results for Elsevier journal '.$param['j'], 404); if($names)
return trim($names->plaintext);
return '';
}
foreach($html->find('.pod-listing') as $article){ // Extracts the timestamp from an article
private function ExtractArticleTimestamp ($article){
$time = $article->find('.article-info', 0);
if($time){
$timestring = trim($time->plaintext);
/*
The format depends on the age of an article:
- Available online 29 July 2016
- July 2016
- MayJune 2016
*/
if(preg_match('/\S*(\d+\s\S+\s\d{4})/ims', $timestring, $matches)){
return strtotime($matches[0]);
} elseif (preg_match('/([A-Za-z]+\s\d{4})/ims', $timestring, $matches)){
return strtotime($matches[0]);
} elseif (preg_match('/[A-Za-z]+\-([A-Za-z]+\s\d{4})/ims', $timestring, $matches)){
return strtotime($matches[0]);
} else {
return 0;
}
}
return 0;
}
$item = new \Item(); // Extracts the content from an article
$item->uri=$article->find('.pod-listing-header>a',0)->getAttribute('href').'?np=y'; private function ExtractArticleContent ($article){
$item->title=$article->find('.pod-listing-header>a',0)->plaintext; $content = $article->find('.article-content', 0);
$item->name=trim($article->find('small',0)->plaintext); if($content){
$item->timestamp=strtotime($article->find('.article-info',0)->plaintext); return trim($content->plaintext);
$item->content=trim($article->find('.article-content',0)->plaintext); }
return '';
}
$this->items[]=$item; public function collectData(array $param){
} $uri = 'http://www.journals.elsevier.com/' . $param['j'] . '/recent-articles/';
} $html = file_get_html($uri) or $this->returnError('No results for Elsevier journal '.$param['j'], 404);
public function getName(){ foreach($html->find('.pod-listing') as $article){
return 'Elsevier journals recent articles'; $item = new \Item();
} $item->uri = $article->find('.pod-listing-header>a',0)->getAttribute('href').'?np=y';
$item->title = $article->find('.pod-listing-header>a',0)->plaintext;
$item->author = $this->ExtractArticleName($article);
$item->timestamp = $this->ExtractArticleTimestamp($article);
$item->content = $this->ExtractArticleContent($article);
$this->items[] = $item;
}
}
public function getURI(){ public function getCacheDuration(){
return 'http://www.journals.elsevier.com'; return 43200; // 12h
} }
public function getCacheDuration(){
return 43200; // 12h
}
} }
?>

View file

@ -3,10 +3,10 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = 'ORelio'; $this->maintainer = 'ORelio';
$this->name = $this->getName(); $this->name = 'Est-ce qu\'on met en prod aujourd\'hui ?';
$this->uri = $this->getURI(); $this->uri = 'https://www.estcequonmetenprodaujourdhui.info/';
$this->description = $this->getDescription(); $this->description = 'Should we put a website in production today? (French)';
$this->update = "02/07/2016"; $this->update = "2016-08-09";
} }
public function collectData(array $param) { public function collectData(array $param) {
@ -20,16 +20,8 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
$html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request EstCeQuonMetEnProd: '.$this->getURI(), 500); $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request EstCeQuonMetEnProd: '.$this->getURI(), 500);
$img = $html->find('img', 0);
if (is_object($img)) {
$img = $img->src;
if ($img[0] == '/')
$img = substr($this->getURI(), 0, strlen($this->getURI()) - 1).$img;
}
$item = new \Item(); $item = new \Item();
$item->uri = $this->getURI().'#'.date('Y-m-d'); $item->uri = $this->getURI().'#'.date('Y-m-d');
$item->thumbnailUri = $img;
$item->title = $this->getName(); $item->title = $this->getName();
$item->author = 'Nicolas Hoffmann'; $item->author = 'Nicolas Hoffmann';
$item->timestamp = strtotime('today midnight'); $item->timestamp = strtotime('today midnight');
@ -37,18 +29,6 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
$this->items[] = $item; $this->items[] = $item;
} }
public function getName() {
return 'Est-ce qu\'on met en prod aujourd\'hui ?';
}
public function getURI() {
return 'https://www.estcequonmetenprodaujourdhui.info/';
}
public function getDescription() {
return 'Should we put a website in production today? (French)';
}
public function getCacheDuration() { public function getCacheDuration() {
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -1,56 +0,0 @@
<?php
class FSBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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){
function FS_StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function FS_ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.fiche-actualite', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
return $text;
}
$html = $this->file_get_html('http://www.futura-sciences.com/rss/actualites.xml') or $this->returnError('Could not request Futura Sciences.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = FS_StripCDATA($element->find('title', 0)->innertext);
$item->uri = FS_StripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = FS_ExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'Futura Sciences';
}
public function getURI(){
return 'http://www.futura-sciences.com/';
}
public function getCacheDuration(){
return 3600; // 1 hour
// return 0; // 1 hour
}
}

View file

@ -7,7 +7,7 @@ class FacebookBridge extends BridgeAbstract{
$this->name = "Facebook"; $this->name = "Facebook";
$this->uri = "http://www.facebook.com/"; $this->uri = "http://www.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->description = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117";
$this->update = "31/03/2016"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -197,15 +197,8 @@ class FacebookBridge extends BridgeAbstract{
if (strlen($title) > 64) if (strlen($title) > 64)
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...'; $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...';
//Use first image as thumbnail if available, or profile pic fallback
$thumbnail = $post->find('img', 1);
if (is_object($thumbnail))
$thumbnail = $thumbnail->src;
else $thumbnail = $profilePic;
//Build and add final item //Build and add final item
$item->uri = 'https://facebook.com'.$post->find('abbr')[0]->parent()->getAttribute('href'); $item->uri = 'https://facebook.com'.$post->find('abbr')[0]->parent()->getAttribute('href');
$item->thumbnailUri = $thumbnail;
$item->content = $content; $item->content = $content;
$item->title = $title; $item->title = $title;
$item->author = $author; $item->author = $author;
@ -226,10 +219,6 @@ class FacebookBridge extends BridgeAbstract{
return (isset($this->name) ? $this->name.' - ' : '').'Facebook Bridge'; return (isset($this->name) ? $this->name.' - ' : '').'Facebook Bridge';
} }
public function getURI() {
return 'http://facebook.com';
}
public function getCacheDuration() { public function getCacheDuration() {
return 300; // 5 minutes return 300; // 5 minutes
} }

View file

@ -7,7 +7,7 @@ Class FierPandaBridge extends BridgeAbstract{
$this->name = "Fier Panda Bridge"; $this->name = "Fier Panda Bridge";
$this->uri = "http://www.fier-panda.fr/"; $this->uri = "http://www.fier-panda.fr/";
$this->description = "Returns latest articles from Fier Panda."; $this->description = "Returns latest articles from Fier Panda.";
$this->update = "2015-12-11"; $this->update = "2016-08-09";
} }
@ -27,14 +27,6 @@ Class FierPandaBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'Fier Panda';
}
public function getURI(){
return 'http://www.fier-panda.fr';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -5,33 +5,37 @@ class FlickrExploreBridge extends BridgeAbstract{
$this->maintainer = "sebsauvage"; $this->maintainer = "sebsauvage";
$this->name = "Flickr Explore"; $this->name = "Flickr Explore";
$this->uri = "http://www.flickr.com/explore"; $this->uri = "https://www.flickr.com/explore";
$this->description = "Returns the latest interesting images from Flickr"; $this->description = "Returns the latest interesting images from Flickr";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ public function collectData(array $param){
$html = $this->file_get_html('http://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404); $html = $this->file_get_html('https://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404);
foreach($html->find('span.photo_container') as $element) { foreach($html->find('.photo-list-photo-view') as $element) {
// Get the styles
$style = explode(';', $element->style);
// Get the background-image style
$backgroundImage = explode(':', end($style));
// URI type : url(//cX.staticflickr.com/X/XXXXX/XXXXXXXXX.jpg)
$imageURI = trim(str_replace(['url(', ')'], '', end($backgroundImage)));
// Get the image ID
$imageURIs = explode('_', basename($imageURI));
$imageID = reset($imageURIs);
// Get the image JSON via Flickr API
$imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnError('Could not request Flickr.', 404); // FIXME: Request time too long...
$item = new \Item(); $item = new \Item();
$item->uri = 'http://flickr.com'.$element->find('a',0)->href; $item->uri = 'https://flickr.com/photo.gne?id='.$imageID;
$item->thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src'); $item->content = '<a href="' . $item->uri . '"><img src="' . $imageURI . '" /></a>'; // FIXME: Filter javascript ?
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>'; // FIXME: Filter javascript ? $item->title = $imageJSON->photo->title->_content;
$item->title = $element->find('a',0)->title;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Flickr Explore';
}
public function getURI(){
return 'http://www.flickr.com/explore';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -7,7 +7,7 @@ class FlickrTagBridge extends BridgeAbstract{
$this->name = "Flickr TagUser"; $this->name = "Flickr TagUser";
$this->uri = "http://www.flickr.com/"; $this->uri = "http://www.flickr.com/";
$this->description = "Returns the tagged or user images from Flickr"; $this->description = "Returns the tagged or user images from Flickr";
$this->update = "2014-05-26"; $this->update = "2016-08-09";
$this->parameters["By keyword"] = $this->parameters["By keyword"] =
'[ '[
@ -44,21 +44,13 @@ class FlickrTagBridge extends BridgeAbstract{
foreach($html->find('span.photo_container') as $element) { foreach($html->find('span.photo_container') as $element) {
$item = new \Item(); $item = new \Item();
$item->uri = 'http://flickr.com'.$element->find('a',0)->href; $item->uri = 'http://flickr.com'.$element->find('a',0)->href;
$item->thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src'); $thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src');
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>'; // FIXME: Filter javascript ? $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a>'; // FIXME: Filter javascript ?
$item->title = $element->find('a',0)->title; $item->title = $element->find('a',0)->title;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Flickr Tag';
}
public function getURI(){
return 'http://www.flickr.com/search/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -7,7 +7,7 @@ class FootitoBridge extends BridgeAbstract{
$this->name = "Footito"; $this->name = "Footito";
$this->uri = "http://www.footito.fr/"; $this->uri = "http://www.footito.fr/";
$this->description = "Footito"; $this->description = "Footito";
$this->update = "21/11/2013"; $this->update = "2016-08-09";
} }
@ -36,25 +36,9 @@ class FootitoBridge extends BridgeAbstract{
$info = $element->find('div.infos', 0); $info = $element->find('div.infos', 0);
$item->timestamp = strtotime($info->find('time', 0)->datetime); $item->timestamp = strtotime($info->find('time', 0)->datetime);
$item->name = $info->find('a.auteur', 0)->plaintext; $item->author = $info->find('a.auteur', 0)->plaintext;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'footito';
}
public function getURI(){
return 'http://www.footito.fr/';
}
public function getCacheDuration(){
return 3600; // 1h hours
}
public function getDescription(){
return "Footito via rss-bridge";
}
} }
?>

View file

@ -7,7 +7,7 @@ class FourchanBridge extends BridgeAbstract{
$this->name = "4chan"; $this->name = "4chan";
$this->uri = "https://www.4chan.org/"; $this->uri = "https://www.4chan.org/";
$this->description = "Returns posts from the specified thread"; $this->description = "Returns posts from the specified thread";
$this->update = "2015-02-01"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -60,14 +60,6 @@ class FourchanBridge extends BridgeAbstract{
$this->items = array_reverse($this->items); $this->items = array_reverse($this->items);
} }
public function getName(){
return '4chan';
}
public function getURI(){
return 'https://www.4chan.org/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 300; // 5min return 300; // 5min
} }

View file

@ -1,69 +0,0 @@
<?php
class FrandroidBridge extends BridgeAbstract
{
public function loadMetadatas() {
$this->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)
{
function FrandroidStripCDATA($string)
{
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function FrandroidExtractContent($url)
{
$html2 = $this->file_get_html($url);
$html3 = $html2->find('div.post-content', 0);
$html3->find('div.no-sidebar-ad-top', 0)->outertext = '';
$ret = $html3->find('div.shortcode-container');
foreach ($ret as $value) {
$value->outertext = '';
}
$html3->find('div#hrr-link', 0)->outertext = '';
$text = $html3->innertext;
$text = strip_tags($text, '<h1><span><h2><p><b><a><blockquote><img><em><ul><ol>');
return $text;
}
$html = $this->file_get_html('http://feeds.feedburner.com/Frandroid?format=xml') or $this->returnError('Could not request Frandroid.', 404);
$limit = 0;
foreach ($html->find('item') as $element) {
if ($limit < 5) {
$item = new \Item();
$item->title = FrandroidStripCDATA($element->find('title', 0)->innertext);
$item->uri = FrandroidStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = FrandroidExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName()
{
return 'Frandroid';
}
public function getURI()
{
return 'http://www.frandroid.com/';
}
public function getCacheDuration()
{
return 300; // 5min
}
}

View file

@ -8,7 +8,7 @@ class Freenews extends RssExpander {
$this->name = "Freenews"; $this->name = "Freenews";
$this->uri = "http://freenews.fr"; $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->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->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -38,7 +38,7 @@ class Freenews extends RssExpander {
$content = $articlePage->find('.post-container', 0); $content = $articlePage->find('.post-container', 0);
$item->content = $content->innertext; $item->content = $content->innertext;
$item->name = $articlePage->find('a[rel=author]', 0)->innertext; $item->author = $articlePage->find('a[rel=author]', 0)->innertext;
// format should parse 2014-03-25T16:21:20Z. But, according to http://stackoverflow.com/a/10478469, it is not that simple // format should parse 2014-03-25T16:21:20Z. But, according to http://stackoverflow.com/a/10478469, it is not that simple
$item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); $item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem);
return $item; return $item;

View file

@ -4,10 +4,10 @@ class FuturaSciencesBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = 'ORelio'; $this->maintainer = 'ORelio';
$this->name = $this->getName(); $this->name = 'Futura-Sciences Bridge';
$this->uri = $this->getURI(); $this->uri = 'http://www.futura-sciences.com/';
$this->description = 'Returns the newest articles.'; $this->description = 'Returns the newest articles.';
$this->update = '2016-03-20'; $this->update = '2016-08-09';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -149,6 +149,23 @@ class FuturaSciencesBridge extends BridgeAbstract {
return $string; return $string;
} }
// Extracts the author from an article or element
function ExtractAuthor($article, $element){
$article_author = $article->find('span.author', 0);
if($article_author){
$authorname = trim(str_replace(', Futura-Sciences', '', $article_author->plaintext));
if(empty($authorname)){
$element_author = $element->find('author', 0);
if($element_author)
$authorname = StripCDATA($element_author->plaintext);
else
return '';
}
return $authorname;
}
return '';
}
if (empty($param['feed'])) if (empty($param['feed']))
$this->returnError('Please select a feed to display.'.$url, 400); $this->returnError('Please select a feed to display.'.$url, 400);
if ($param['feed'] !== preg_replace('/[^a-zA-Z-\/]+/', '', $param['feed']) || substr_count($param['feed'], '/') > 1 || strlen($param['feed'] > 64)) if ($param['feed'] !== preg_replace('/[^a-zA-Z-\/]+/', '', $param['feed']) || substr_count($param['feed'], '/') > 1 || strlen($param['feed'] > 64))
@ -163,9 +180,6 @@ class FuturaSciencesBridge extends BridgeAbstract {
$article_url = str_replace('#xtor=RSS-8', '', StripCDATA($element->find('guid', 0)->plaintext)); $article_url = str_replace('#xtor=RSS-8', '', StripCDATA($element->find('guid', 0)->plaintext));
$article = $this->file_get_html($article_url) or $this->returnError('Could not request Futura-Sciences: '.$article_url, 500); $article = $this->file_get_html($article_url) or $this->returnError('Could not request Futura-Sciences: '.$article_url, 500);
$contents = $article->find('div.content', 0)->innertext; $contents = $article->find('div.content', 0)->innertext;
$author = trim(str_replace(', Futura-Sciences', '', $article->find('span.author', 0)->plaintext));
if (empty($author))
$author = StripCDATA($element->find('author', 0)->plaintext);
foreach (array( foreach (array(
'<div class="clear', '<div class="clear',
@ -192,10 +206,9 @@ class FuturaSciencesBridge extends BridgeAbstract {
$contents = StripWithDelimiters($contents, 'fs:xt:clickname="', '"'); $contents = StripWithDelimiters($contents, 'fs:xt:clickname="', '"');
$item = new \Item(); $item = new \Item();
$item->author = $author; $item->author = ExtractAuthor($article, $element);
$item->uri = $article_url; $item->uri = $article_url;
$item->title = StripCDATA($element->find('title', 0)->innertext); $item->title = StripCDATA($element->find('title', 0)->innertext);
$item->thumbnailUri = StripCDATA($element->find('enclosure', 0)->url);
$item->timestamp = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext)); $item->timestamp = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext));
$item->content = trim($contents); $item->content = trim($contents);
$this->items[] = $item; $this->items[] = $item;
@ -204,16 +217,4 @@ class FuturaSciencesBridge extends BridgeAbstract {
} }
} }
public function getName() {
return 'Futura-Sciences Bridge';
}
public function getURI() {
return 'http://www.futura-sciences.com/';
}
public function getCacheDuration() {
return 3600;
}
} }

View file

@ -7,9 +7,9 @@ class GBAtempBridge extends BridgeAbstract {
$this->maintainer = 'ORelio'; $this->maintainer = 'ORelio';
$this->name = 'GBAtemp'; $this->name = 'GBAtemp';
$this->uri = $this->getURI(); $this->uri = 'http://gbatemp.net/';
$this->description = 'GBAtemp is a user friendly underground video game community.'; $this->description = 'GBAtemp is a user friendly underground video game community.';
$this->update = '2016-02-14'; $this->update = '2016-08-09';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -40,48 +40,46 @@ class GBAtempBridge extends BridgeAbstract {
]'; ]';
} }
private function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
private function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) {
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
private function build_item($uri, $title, $author, $timestamp, $content) {
$item = new \Item();
$item->uri = $uri;
$item->title = $title;
$item->author = $author;
$item->timestamp = $timestamp;
$item->content = $content;
return $item;
}
private function cleanup_post_content($content, $site_url) {
$content = str_replace(':arrow:', '&#x27a4;', $content);
$content = str_replace('href="attachments/', 'href="'.$site_url.'attachments/', $content);
$content = $this->StripWithDelimiters($content, '<script', '</script>');
return $content;
}
private function fetch_post_content($uri, $site_url) {
$html = $this->file_get_html($uri) or $this->returnError('Could not request GBAtemp: '.$uri, 500);
$content = $html->find('div.messageContent', 0)->innertext;
return $this->cleanup_post_content($content, $site_url);
}
public function collectData(array $param) { public function collectData(array $param) {
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) {
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
function build_item($uri, $title, $author, $timestamp, $thumnail, $content) {
$item = new \Item();
$item->uri = $uri;
$item->title = $title;
$item->author = $author;
$item->timestamp = $timestamp;
$item->thumbnailUri = $thumnail;
$item->content = $content;
return $item;
}
function cleanup_post_content($content, $site_url) {
$content = str_replace(':arrow:', '&#x27a4;', $content);
$content = str_replace('href="attachments/', 'href="'.$site_url.'attachments/', $content);
$content = StripWithDelimiters($content, '<script', '</script>');
return $content;
}
function fetch_post_content($uri, $site_url) {
$html = $this->file_get_html($uri) or $this->returnError('Could not request GBAtemp: '.$uri, 500);
$content = $html->find('div.messageContent', 0)->innertext;
return cleanup_post_content($content, $site_url);
}
$typeFilter = ''; $typeFilter = '';
if (!empty($param['type'])) { if (!empty($param['type'])) {
if ($param['type'] == 'N' || $param['type'] == 'R' || $param['type'] == 'T' || $param['type'] == 'F') { if ($param['type'] == 'N' || $param['type'] == 'R' || $param['type'] == 'T' || $param['type'] == 'F') {
@ -93,51 +91,49 @@ class GBAtempBridge extends BridgeAbstract {
} else $this->returnError('The provided type filter is invalid. Expecting N, R, T, or F.', 400); } else $this->returnError('The provided type filter is invalid. Expecting N, R, T, or F.', 400);
} else $this->returnError('Please provide a type filter. Expecting N, R, T, or F.', 400); } else $this->returnError('Please provide a type filter. Expecting N, R, T, or F.', 400);
$html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request GBAtemp.', 500); $html = $this->file_get_html($this->uri) or $this->returnError('Could not request GBAtemp.', 500);
if ($typeFilter == 'N') { if ($typeFilter == 'N') {
foreach ($html->find('li[class=news_item full]') as $newsItem) { foreach ($html->find('li[class=news_item full]') as $newsItem) {
$url = $this->getURI().$newsItem->find('a', 0)->href; $url = $this->uri.$newsItem->find('a', 0)->href;
$img = $this->getURI().$newsItem->find('img', 0)->src; $time = intval($this->ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$time = intval(ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$author = $newsItem->find('a.username', 0)->plaintext; $author = $newsItem->find('a.username', 0)->plaintext;
$title = $newsItem->find('a', 1)->plaintext; $title = $newsItem->find('a', 1)->plaintext;
$content = fetch_post_content($url, $this->getURI()); $content = $this->fetch_post_content($url, $this->uri);
$this->items[] = build_item($url, $title, $author, $time, $img, $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
} else if ($typeFilter == 'R') { } else if ($typeFilter == 'R') {
foreach ($html->find('li.portal_review') as $reviewItem) { foreach ($html->find('li.portal_review') as $reviewItem) {
$url = $this->getURI().$reviewItem->find('a', 0)->href; $url = $this->uri.$reviewItem->find('a', 0)->href;
$img = $this->getURI().ExtractFromDelimiters($reviewItem->find('a', 0)->style, 'image:url(', ')');
$title = $reviewItem->find('span.review_title', 0)->plaintext; $title = $reviewItem->find('span.review_title', 0)->plaintext;
$content = $this->file_get_html($url) or $this->returnError('Could not request GBAtemp: '.$uri, 500); $content = $this->file_get_html($url) or $this->returnError('Could not request GBAtemp: '.$uri, 500);
$author = $content->find('a.username', 0)->plaintext; $author = $content->find('a.username', 0)->plaintext;
$time = intval(ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$intro = '<p><b>'.($content->find('div#review_intro', 0)->plaintext).'</b></p>'; $intro = '<p><b>'.($content->find('div#review_intro', 0)->plaintext).'</b></p>';
$review = $content->find('div#review_main', 0)->innertext; $review = $content->find('div#review_main', 0)->innertext;
$subheader = '<p><b>'.$content->find('div.review_subheader', 0)->plaintext.'</b></p>'; $subheader = '<p><b>'.$content->find('div.review_subheader', 0)->plaintext.'</b></p>';
$procons = $content->find('table.review_procons', 0)->outertext; $procons = $content->find('table.review_procons', 0)->outertext;
$scores = $content->find('table.reviewscores', 0)->outertext; $scores = $content->find('table.reviewscores', 0)->outertext;
$content = cleanup_post_content($intro.$review.$subheader.$procons.$scores, $this->getURI()); $content = $this->cleanup_post_content($intro.$review.$subheader.$procons.$scores, $this->uri);
$this->items[] = build_item($url, $title, $author, $time, $img, $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
} else if ($typeFilter == 'T') { } else if ($typeFilter == 'T') {
foreach ($html->find('li.portal-tutorial') as $tutorialItem) { foreach ($html->find('li.portal-tutorial') as $tutorialItem) {
$url = $this->getURI().$tutorialItem->find('a', 0)->href; $url = $this->uri.$tutorialItem->find('a', 0)->href;
$title = $tutorialItem->find('a', 0)->plaintext; $title = $tutorialItem->find('a', 0)->plaintext;
$time = intval(ExtractFromDelimiters($tutorialItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($tutorialItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$author = $tutorialItem->find('a.username', 0)->plaintext; $author = $tutorialItem->find('a.username', 0)->plaintext;
$content = fetch_post_content($url, $this->getURI()); $content = $this->fetch_post_content($url, $this->uri);
$this->items[] = build_item($url, $title, $author, $time, '', $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
} else if ($typeFilter == 'F') { } else if ($typeFilter == 'F') {
foreach ($html->find('li.rc_item') as $postItem) { foreach ($html->find('li.rc_item') as $postItem) {
$url = $this->getURI().$postItem->find('a', 1)->href; $url = $this->uri.$postItem->find('a', 1)->href;
$title = $postItem->find('a', 1)->plaintext; $title = $postItem->find('a', 1)->plaintext;
$time = intval(ExtractFromDelimiters($postItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($postItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$author = $postItem->find('a.username', 0)->plaintext; $author = $postItem->find('a.username', 0)->plaintext;
$content = fetch_post_content($url, $this->getURI()); $content = $this->fetch_post_content($url, $this->uri);
$this->items[] = build_item($url, $title, $author, $time, '', $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
} }
} }
@ -146,10 +142,6 @@ class GBAtempBridge extends BridgeAbstract {
return 'GBAtemp'.(empty($this->filter) ? '' : ' '.$this->filter).' Bridge'; return 'GBAtemp'.(empty($this->filter) ? '' : ' '.$this->filter).' Bridge';
} }
public function getURI() {
return 'http://gbatemp.net/';
}
public function getCacheDuration() { public function getCacheDuration() {
return ($this->filter === 'Forum') ? 300 : 3600; // 5 minutes / 1 hour return ($this->filter === 'Forum') ? 300 : 3600; // 5 minutes / 1 hour
} }

View file

@ -10,7 +10,7 @@ class Gawker extends RssExpander{
$this->name = "Gawker media"; $this->name = "Gawker media";
$this->uri = "http://feeds.gawker.com/"; $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->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->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -53,7 +53,7 @@ class Gawker extends RssExpander{
$vcard = $articlePage->find('.vcard', 0); $vcard = $articlePage->find('.vcard', 0);
if(is_object($vcard)) { if(is_object($vcard)) {
$authorLink = $vcard->find('a', 0); $authorLink = $vcard->find('a', 0);
$item->name = $authorLink->innertext; $item->author = $authorLink->innertext;
// TODO use author link href to fill the feed info // TODO use author link href to fill the feed info
} }
// $this->message("item quite loaded : ".var_export($item, true)); // $this->message("item quite loaded : ".var_export($item, true));

View file

@ -7,7 +7,7 @@ class GelbooruBridge extends BridgeAbstract{
$this->name = "Gelbooru"; $this->name = "Gelbooru";
$this->uri = "http://gelbooru.com/"; $this->uri = "http://gelbooru.com/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -42,22 +42,14 @@ class GelbooruBridge extends BridgeAbstract{
$item->uri = 'http://gelbooru.com/'.$element->find('a', 0)->href; $item->uri = 'http://gelbooru.com/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time(); $item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt'); $item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Gelbooru | '.$item->postid; $item->title = 'Gelbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags; $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Gelbooru';
}
public function getURI(){
return 'http://gelbooru.com/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -9,7 +9,7 @@ class GiphyBridge extends BridgeAbstract{
$this->name = "Giphy Bridge"; $this->name = "Giphy Bridge";
$this->uri = "http://giphy.com/"; $this->uri = "http://giphy.com/";
$this->description = "Bridge for giphy.com"; $this->description = "Bridge for giphy.com";
$this->update = "2014-12-05"; $this->update = "2016-08-09";
$this->parameters["By tag"] = $this->parameters["By tag"] =
'[ '[
@ -81,19 +81,7 @@ class GiphyBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'Giphy Bridge';
}
public function getURI(){
return 'http://giphy.com/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 300; // 5 minutes return 300; // 5 minutes
} }
public function getUsername(){
return $this->items[0]->username;
}
} }

View file

@ -12,9 +12,9 @@ class GithubIssueBridge extends BridgeAbstract{
$this->name = 'Github Issue'; $this->name = 'Github Issue';
$this->uri = ''; $this->uri = '';
$this->description = 'Returns the comments of a github project issue'; $this->description = 'Returns the comments of a github project issue';
$this->update = '2016-06-25'; $this->update = '2016-08-09';
$this->parameters= $this->parameters[]=
'[ '[
{ {
"name" : "User name", "name" : "User name",
@ -40,7 +40,7 @@ class GithubIssueBridge extends BridgeAbstract{
foreach($html->find('.js-comment-container') as $comment){ foreach($html->find('.js-comment-container') as $comment){
$item = new \Item(); $item = new \Item();
$item->name=$comment->find('img',0)->getAttribute('alt'); $item->author=$comment->find('img',0)->getAttribute('alt');
$comment=$comment->firstChild()->nextSibling(); $comment=$comment->firstChild()->nextSibling();
@ -53,14 +53,6 @@ class GithubIssueBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'Github Issue';
}
public function getURI(){
return '';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 600; // ten minutes return 600; // ten minutes
} }

View file

@ -12,9 +12,9 @@ class GitlabCommitsBridge extends BridgeAbstract{
$this->name = 'Gitlab Commits'; $this->name = 'Gitlab Commits';
$this->uri = ''; $this->uri = '';
$this->description = 'Returns the commits of a project hosted on a gitlab instance'; $this->description = 'Returns the commits of a project hosted on a gitlab instance';
$this->update = '2016-06-19'; $this->update = '2016-08-09';
$this->parameters= $this->parameters[] =
'[ '[
{ {
"name" : "Base URI", "name" : "Base URI",
@ -27,7 +27,7 @@ class GitlabCommitsBridge extends BridgeAbstract{
{ {
"name" : "Project name", "name" : "Project name",
"identifier" : "p" "identifier" : "p"
} },
{ {
"name" : "Project branch", "name" : "Project branch",
"identifier" : "b" "identifier" : "b"
@ -64,7 +64,7 @@ class GitlabCommitsBridge extends BridgeAbstract{
$item->title=$a->plaintext; $item->title=$a->plaintext;
} }
if(in_array('commit-author-link',$classes)){ if(in_array('commit-author-link',$classes)){
$item->name=trim($a->plaintext); $item->author=trim($a->plaintext);
} }
} }
@ -79,16 +79,4 @@ class GitlabCommitsBridge extends BridgeAbstract{
$this->items[]=$item; $this->items[]=$item;
} }
} }
public function getName(){
return 'Gitlab Commits';
}
public function getURI(){
return '';
}
public function getCacheDuration(){
return 3600; // one hour
}
} }

View file

@ -7,7 +7,7 @@ class GizmodoFRBridge extends BridgeAbstract{
$this->name = "GizmodoFR"; $this->name = "GizmodoFR";
$this->uri = "http://www.gizmodo.fr/"; $this->uri = "http://www.gizmodo.fr/";
$this->description = "Returns the 15 newest posts from GizmodoFR (full text)."; $this->description = "Returns the 15 newest posts from GizmodoFR (full text).";
$this->update = "2014-07-14"; $this->update = "2016-08-09";
} }
@ -43,14 +43,6 @@ class GizmodoFRBridge extends BridgeAbstract{
} }
public function getName(){
return 'GizmodoFR';
}
public function getURI(){
return 'http://www.gizmodo.fr/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30min return 1800; // 30min
} }

View file

@ -17,7 +17,7 @@ class GoogleSearchBridge extends BridgeAbstract{
$this->name = "Google search"; $this->name = "Google search";
$this->uri = "https://www.google.com/"; $this->uri = "https://www.google.com/";
$this->description = "Returns most recent results from Google search."; $this->description = "Returns most recent results from Google search.";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -62,10 +62,6 @@ class GoogleSearchBridge extends BridgeAbstract{
return (!empty($this->request) ? $this->request .' - ' : '') .'Google search'; return (!empty($this->request) ? $this->request .' - ' : '') .'Google search';
} }
public function getURI(){
return 'http://google.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -2,53 +2,33 @@
class GuruMedBridge extends BridgeAbstract{ class GuruMedBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "qwertygc"; $this->maintainer = "qwertygc";
$this->name = "GuruMed"; $this->name = "GuruMed";
$this->uri = "http://www.gurumed.org"; $this->uri = "http://www.gurumed.org";
$this->description = "Returns the 5 newest posts from Gurumed (full text)"; $this->description = "Returns the 5 newest posts from Gurumed (full text)";
$this->update = "03/10/2015"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function GurumedStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
function GurumedStripCDATA($string) { $string = str_replace(']]>', '', $string);
$string = str_replace('<![CDATA[', '', $string); return $string;
$string = str_replace(']]>', '', $string);
return $string;
}
function GurumedExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.entry', 0)->innertext;
return $text;
}
$html = $this->file_get_html('http://gurumed.org/feed') or $this->returnError('Could not request Gurumed.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = GurumedStripCDATA($element->find('title', 0)->innertext);
$item->uri = GurumedStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = GurumedExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
} }
}
public function getName(){ public function collectData(array $param){
return 'Gurumed'; $html = $this->file_get_html('http://gurumed.org/feed') or $this->returnError('Could not request Gurumed.', 404);
} $limit = 0;
public function getURI(){ foreach($html->find('item') as $element) {
return 'http://gurumed.org/'; if($limit < 5) {
} $item = new \Item();
$item->title = $this->GurumedStripCDATA($element->find('title', 0)->innertext);
public function getCacheDuration(){ $item->uri = $this->GurumedStripCDATA($element->find('guid', 0)->plaintext);
return 3600; // 1 hour $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
} $item->content = $this->GurumedStripCDATA(strip_tags($element->find('description', 0), '<p><a><br>'));
$this->items[] = $item;
$limit++;
}
}
}
} }

View file

@ -10,7 +10,7 @@ class HDWallpapersBridge extends BridgeAbstract {
$this->name = "HD Wallpapers Bridge"; $this->name = "HD Wallpapers Bridge";
$this->uri = "http://www.hdwallpapers.in/"; $this->uri = "http://www.hdwallpapers.in/";
$this->description = "Returns the latests wallpapers from HDWallpapers"; $this->description = "Returns the latests wallpapers from HDWallpapers";
$this->update = "2015-04-08"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -63,8 +63,7 @@ class HDWallpapersBridge extends BridgeAbstract {
$item->uri = $baseUri.'/download'.str_replace('wallpapers.html', $this->resolution.'.jpg', $element->href); $item->uri = $baseUri.'/download'.str_replace('wallpapers.html', $this->resolution.'.jpg', $element->href);
$item->timestamp = time(); $item->timestamp = time();
$item->title = $element->find('p', 0)->text(); $item->title = $element->find('p', 0)->text();
$item->thumbnailUri = $baseUri.$thumbnail->src; $item->content = $item->title.'<br><a href="'.$item->uri.'"><img src="'.$baseUri.$thumbnail->src.'" /></a>';
$item->content = $item->title.'<br><a href="'.$item->uri.'"><img src="'.$item->thumbnailUri.'" /></a>';
$this->items[] = $item; $this->items[] = $item;
$num++; $num++;
@ -78,10 +77,6 @@ class HDWallpapersBridge extends BridgeAbstract {
return 'HDWallpapers - '.str_replace(['__', '_'], [' & ', ' '], $this->category).' ['.$this->resolution.']'; return 'HDWallpapers - '.str_replace(['__', '_'], [' & ', ' '], $this->category).' ['.$this->resolution.']';
} }
public function getURI(){
return 'http://www.hdwallpapers.in';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 43200; // 12 hours return 43200; // 12 hours
} }

View file

@ -7,7 +7,7 @@ class HentaiHavenBridge extends BridgeAbstract{
$this->name = "Hentai Haven"; $this->name = "Hentai Haven";
$this->uri = "http://hentaihaven.org/"; $this->uri = "http://hentaihaven.org/";
$this->description = "Returns releases from Hentai Haven"; $this->description = "Returns releases from Hentai Haven";
$this->update = "2015-01-16"; $this->update = "2016-08-09";
} }
@ -15,23 +15,15 @@ class HentaiHavenBridge extends BridgeAbstract{
$html = $this->file_get_html('http://hentaihaven.org/') or $this->returnError('Could not request Hentai Haven.', 404); $html = $this->file_get_html('http://hentaihaven.org/') or $this->returnError('Could not request Hentai Haven.', 404);
foreach($html->find('div.zoe-grid') as $element) { foreach($html->find('div.zoe-grid') as $element) {
$item = new \Item(); $item = new \Item();
$item->uri = $this->getURI().$element->find('div.brick-content h3 a', 0)->href; $item->uri = $element->find('div.brick-content h3 a', 0)->href;
$item->thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src'); $thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src');
$item->title = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES'); $item->title = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES');
$item->tags = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext; $item->tags = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext;
$item->content = 'Tags: ' . $item->tags.'<br><br><a href="' . $item->uri . '"><img width="300" height="169" src="' . $item->thumbnailUri . '" /></a><br>' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext; $item->content = 'Tags: ' . $item->tags.'<br><br><a href="' . $item->uri . '"><img width="300" height="169" src="' . $thumbnailUri . '" /></a><br>' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Hentai Haven';
}
public function getURI(){
return '';
}
public function getDescription(){
return "Hentai Haven | Everything Else is Irrelevant";
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -9,7 +9,7 @@ class InstagramBridge extends BridgeAbstract{
$this->name = "Instagram Bridge"; $this->name = "Instagram Bridge";
$this->uri = "http://instagram.com/"; $this->uri = "http://instagram.com/";
$this->description = "Returns the newest images"; $this->description = "Returns the newest images";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -77,12 +77,4 @@ class InstagramBridge extends BridgeAbstract{
public function getName(){ public function getName(){
return (!empty($this->request) ? $this->request .' - ' : '') .'Instagram Bridge'; return (!empty($this->request) ? $this->request .' - ' : '') .'Instagram Bridge';
} }
public function getURI(){
return 'http://instagram.com/';
}
public function getCacheDuration(){
return 3600;
}
} }

View file

@ -3,10 +3,10 @@ class JapanExpoBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = 'Ginko'; $this->maintainer = 'Ginko';
$this->name = 'JapanExpo'; $this->name = 'Japan Expo Actualités';
$this->uri = 'http://www.japan-expo-paris.com/fr/actualites'; $this->uri = 'http://www.japan-expo-paris.com/fr/actualites';
$this->description = 'Returns most recent entries from Japan Expo actualités.'; $this->description = 'Returns most recent entries from Japan Expo actualités.';
$this->update = '2016-06-12'; $this->update = '2016-08-09';
$this->parameters[] = $this->parameters[] =
'[ '[
{ {
@ -96,21 +96,12 @@ class JapanExpoBridge extends BridgeAbstract{
$item->uri = $url; $item->uri = $url;
$item->title = $title; $item->title = $title;
$item->timestamp = $timestamp; $item->timestamp = $timestamp;
$item->thumbnailUri = $thumbnail;
$item->content = $content; $item->content = $content;
$this->items[] = $item; $this->items[] = $item;
$count++; $count++;
} }
} }
public function getName(){
return 'Japan Expo Actualités';
}
public function getURI(){
return 'http://www.japan-expo-paris.com/fr/actualites';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 14400; // 4 hours return 14400; // 4 hours
} }

View file

@ -7,7 +7,7 @@ class KonachanBridge extends BridgeAbstract{
$this->name = "Konachan"; $this->name = "Konachan";
$this->uri = "http://konachan.com/"; $this->uri = "http://konachan.com/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -44,21 +44,12 @@ class KonachanBridge extends BridgeAbstract{
$item->postid = $json['id']; $item->postid = $json['id'];
$item->timestamp = $json['created_at']; $item->timestamp = $json['created_at'];
$item->imageUri = $json['file_url']; $item->imageUri = $json['file_url'];
$item->thumbnailUri = $json['preview_url'];
$item->title = 'Konachan | '.$json['id']; $item->title = 'Konachan | '.$json['id'];
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$json['tags']; $item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Konachan';
}
public function getURI(){
return 'http://konachan.com/post';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -2,55 +2,40 @@
class KoreusBridge extends BridgeAbstract{ class KoreusBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "pit-fgfjiudghdf"; $this->maintainer = "pit-fgfjiudghdf";
$this->name = "Koreus"; $this->name = "Koreus";
$this->uri = "http://www.koreus.com/"; $this->uri = "http://www.koreus.com/";
$this->description = "Returns the 5 newest posts from Koreus (full text)"; $this->description = "Returns the 5 newest posts from Koreus (full text)";
$this->update = "2014-05-26"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function KoreusStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function KoreusStripCDATA($string) { private function KoreusExtractContent($url) {
$string = str_replace('<![CDATA[', '', $string); $html2 = $this->file_get_html($url);
$string = str_replace(']]>', '', $string); $text = $html2->find('p[class=itemText]', 0)->innertext;
return $string; $text = utf8_encode(preg_replace('/(Sur le m.+?)+$/i','',$text));
} return $text;
function KoreusExtractContent($url) { }
$html2 = $this->file_get_html($url);
$text = $html2->find('p[class=itemText]', 0)->innertext;
$text = utf8_encode(preg_replace('/(Sur le m.+?)+$/i','',$text));
return $text;
}
$html = $this->file_get_html('http://feeds.feedburner.com/Koreus-articles') or $this->returnError('Could not request Koreus.', 404);
$limit = 0;
foreach($html->find('item') as $element) { public function collectData(array $param){
if($limit < 5) { $html = $this->file_get_html('http://feeds.feedburner.com/Koreus-articles') or $this->returnError('Could not request Koreus.', 404);
$item = new \Item(); $limit = 0;
$item->title = KoreusStripCDATA($element->find('title', 0)->innertext);
$item->uri = KoreusStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = KoreusExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
} foreach($html->find('item') as $element) {
if($limit < 5) {
public function getName(){ $item = new \Item();
return 'Koreus'; $item->title = $this->KoreusStripCDATA($element->find('title', 0)->innertext);
} $item->uri = $this->KoreusStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
public function getURI(){ $item->content = $this->KoreusExtractContent($item->uri);
return 'http://www.koreus.com/'; $this->items[] = $item;
} $limit++;
}
public function getCacheDuration(){ }
return 3600; // 1 hour }
}
} }

282
bridges/KununuBridge.php Normal file
View file

@ -0,0 +1,282 @@
<?php
class KununuBridge extends BridgeAbstract{
public function loadMetadatas(){
$this->maintainer = "logmanoriginal";
$this->name = "Kununu Bridge"; /* This will be replaced later! */
$this->uri = "https://www.kununu.com"; /* This will be replaced later! */
$this->description = "Returns the latest reviews for a company and site of your choice.";
$this->update = "2016-08-10";
$this->parameters['global'] =
'[
{
"name" : "Site",
"identifier" : "site",
"type" : "list",
"required" : "true",
"exampleValue" : "United States",
"title" : "Select your site",
"values" :
[
{
"name" : "Austria",
"value" : "at"
},
{
"name" : "Germany",
"value" : "de"
},
{
"name" : "Switzerland",
"value" : "ch"
},
{
"name" : "United States",
"value" : "us"
}
]
},
{
"name" : "Load full article",
"identifier" : "full",
"type" : "checkbox",
"required" : "false",
"exampleValue" : "checked",
"title" : "Activate to load full article"
}
]';
$this->parameters[] =
'[
{
"name" : "Company",
"identifier" : "company",
"type" : "text",
"required" : "true",
"exampleValue" : "kununu-us",
"title" : "Insert company name (i.e. Kununu US) or URI path (i.e. kununu-us)"
}
]';
}
public function collectData(array $params){
// Get Site
$site = strtolower(trim($params['site']));
if(!isset($site) || empty($site) || !$this->site_is_valid($site))
$this->returnError('You must specify a valid site (&site=...)!', 400);
// Get Company (fixing whitespace and umlauts)
$company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company']))));
if(!isset($company) || empty($company))
$this->returnError('You must specify a company (&company=...)!', 400);
$full = false; // By default we'll load only short article
if(isset($params['full']))
$full = strtolower(trim($params['full'])) === 'on';
// Get reviews section name (depends on site)
$section = '';
switch($site){
case 'at':
case 'de':
case 'ch':
$section = 'kommentare';
break;
case 'us':
$section = 'reviews';
break;
default:
$this->returnError('The reviews section is not defined for you selection!', 404);
}
// Update URI for the content
$this->uri .= "/{$site}/{$company}/{$section}";
// Load page
$html = $this->file_get_html($this->uri);
if($html === false)
$this->returnError('Unable to receive data from ' . $this->uri . '!', 404);
// Update name for this request
$this->name = $this->extract_company_name($html) . ' - ' . $this->name;
// Find the section with all the panels (reviews)
$section = $html->find('section.kununu-scroll-element', 0);
if($section === false)
$this->returnError('Unable to find panel section!', 404);
// Find all articles (within the panels)
$articles = $section->find('article');
if($articles === false || empty($articles))
$this->returnError('Unable to find articles!', 404);
// Go through all articles
foreach($articles as $article){
$item = new \Item();
$item->author = $this->extract_article_author_position($article);
$item->timestamp = $this->extract_article_date($article);
$item->title = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article);
$item->uri = $this->extract_article_uri($article);
if($full)
$item->content = $this->extract_full_description($item->uri);
else
$item->content = $this->extract_article_description($article);
$this->items[] = $item;
}
}
public function getCacheDuration(){
return 86400; // 1 day
}
/**
* Returns true if the given site is part of the parameters list
*/
private function site_is_valid($site){
$parameter = json_decode($this->parameters['global'], true);
$sites = $parameter[0]['values'];
$site_names = array();
foreach($sites as $site_item)
$site_names[] = $site_item['value'];
return in_array($site, $site_names);
}
/**
* Fixes relative URLs in the given text
*/
private function fix_url($text){
return preg_replace('/href=(\'|\")\//i', 'href="https://www.kununu.com/', $text);
}
/**
* Encodes unmlauts in the given text
*/
private function encode_umlauts($text){
$umlauts = Array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
$replace = Array("ae","oe","ue","Ae","Oe","Ue","ss");
return preg_replace($umlauts, $replace, $text);
}
/**
* Returns the company name from the review html
*/
private function extract_company_name($html){
$panel = $html->find('div.panel', 0);
if($panel === false)
$this->returnError('Cannot find panel for company name!', 404);
$company_name = $panel->find('h1', 0);
if($company_name === false)
$this->returnError('Cannot find company name!', 404);
return $company_name->plaintext;
}
/**
* Returns the date from a given article
*/
private function extract_article_date($article){
// They conviniently provide a time attribute for us :)
$date = $article->find('time[itemprop=dtreviewed]', 0);
if($date === false)
$this->returnError('Cannot find article date!', 404);
return strtotime($date->datetime);
}
/**
* Returns the rating from a given article
*/
private function extract_article_rating($article){
$rating = $article->find('span.rating', 0);
if($rating === false)
$this->returnError('Cannot find article rating!', 404);
return $rating->getAttribute('aria-label');
}
/**
* Returns the summary from a given article
*/
private function extract_article_summary($article){
$summary = $article->find('[itemprop=summary]', 0);
if($summary === false)
$this->returnError('Cannot find article summary!', 404);
return strip_tags($summary->innertext);
}
/**
* Returns the URI from a given article
*/
private function extract_article_uri($article){
// Notice: This first part is the same as in extract_article_summary!
$summary = $article->find('[itemprop=summary]', 0);
if($summary === false)
$this->returnError('Cannot find article summary!', 404);
$anchor = $summary->find('a', 0);
if($anchor === false)
$this->returnError('Cannot find article URI!', 404);
return 'https://www.kununu.com' . $anchor->href;
}
/**
* Returns the position of the author from a given article
*/
private function extract_article_author_position($article){
// We need to parse the aside manually
$aside = $article->find('aside', 0);
if($aside === false)
$this->returnError('Cannot find article author information!', 404);
// Go through all h2 elements to find index of required span (I know... it's stupid)
$author_position = 'Unknown';
foreach($aside->find('h2') as $subject){
if(stristr(strtolower($subject->plaintext), 'position')){ /* This works for at, ch, de, us */
$author_position = $subject->next_sibling()->plaintext;
break;
}
}
return $author_position;
}
/**
* Returns the description from a given article
*/
private function extract_article_description($article){
$description = $article->find('div[itemprop=description]', 0);
if($description === false)
$this->returnError('Cannot find article description!', 404);
return $this->fix_url($description->innertext);
}
/**
* Returns the full description from a given uri
*/
private function extract_full_description($uri){
// Load full article
$html = file_get_html($uri);
if($html === false)
$this->returnError('Could not load full description!', 404);
// Find the article
$article = $html->find('article', 0);
if($article === false)
$this->returnError('Cannot find article!', 404);
// Luckily they use the same layout for the review overview and full article pages :)
return $this->extract_article_description($article);
}
}

View file

@ -12,7 +12,7 @@ class LWNprevBridge extends BridgeAbstract{
$this->name = 'LWN Free Weekly Edition'; $this->name = 'LWN Free Weekly Edition';
$this->uri = 'https://lwn.net/free/bigpage'; $this->uri = 'https://lwn.net/free/bigpage';
$this->description = 'LWN Free Weekly Edition available one week late'; $this->description = 'LWN Free Weekly Edition available one week late';
$this->update = '2016-19-01'; $this->update = '2016-08-09';
} }
@ -88,14 +88,14 @@ class LWNprevBridge extends BridgeAbstract{
switch($h2NextSibling->getAttribute('class')){ switch($h2NextSibling->getAttribute('class')){
case 'FeatureByline': case 'FeatureByline':
$item->name=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent; $item->author=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent;
break; break;
case 'GAByline': case 'GAByline':
$text=$h2NextSibling->textContent; $text=$h2NextSibling->textContent;
$item->name=substr($text,strpos($text,'by ')); $item->author=substr($text,strpos($text,'by '));
break; break;
default: default:
$item->name='LWN'; $item->author='LWN';
break; break;
}; };
@ -160,14 +160,6 @@ class LWNprevBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'LWN Free Weekly Edition';
}
public function getURI(){
return 'https://lwn.net/free/bigpage';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 604800; // one week return 604800; // one week
} }

View file

@ -7,7 +7,7 @@ class LeBonCoinBridge extends BridgeAbstract{
$this->name = "LeBonCoin"; $this->name = "LeBonCoin";
$this->uri = "http://www.leboncoin.fr"; $this->uri = "http://www.leboncoin.fr";
$this->description = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword ."; $this->description = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword .";
$this->update = "2016-05-02"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -275,16 +275,4 @@ class LeBonCoinBridge extends BridgeAbstract{
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'LeBonCoin';
}
public function getURI(){
return 'http://www.leboncoin.fr';
}
public function getCacheDuration(){
return 3600; // 1 hour
}
} }

View file

@ -2,68 +2,59 @@
class LeJournalDuGeekBridge extends BridgeAbstract{ class LeJournalDuGeekBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "polopollo"; $this->maintainer = "polopollo";
$this->name = "journaldugeek.com (FR)"; $this->name = "journaldugeek.com (FR)";
$this->uri = "http://www.journaldugeek.com/"; $this->uri = "http://www.journaldugeek.com/";
$this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; $this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text).";
$this->update = "2014-07-14"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function LeJournalDuGeekStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function LeJournalDuGeekStripCDATA($string) { private function LeJournalDuGeekExtractContent($url) {
$string = str_replace('<![CDATA[', '', $string); $articleHTMLContent = $this->file_get_html($url);
$string = str_replace(']]>', '', $string); $text = $articleHTMLContent->find('div.post-content', 0)->innertext;
return $string;
}
function LeJournalDuGeekExtractContent($url) { foreach($articleHTMLContent->find('a.more') as $element) {
$articleHTMLContent = $this->file_get_html($url); if ($element->innertext == "Source") {
$text = $text.$articleHTMLContent->find('div.post-content', 0)->innertext; $text = $text . '<p><a href="' . $element->href . '">Source : ' . $element->href . '</a></p>';
foreach($articleHTMLContent->find('a.more') as $element) { break;
if ($element->innertext == "Source") { }
$text = $text.'<p><a href="'.$element->href.'">Source : '.$element->href.'</a></p>'; }
break;
}
}
foreach($articleHTMLContent->find('iframe') as $element) {
if (preg_match("/youtube/i", $element->src)) {
$text = $text.'// An IFRAME to Youtube was included in the article: <a href="'.$element->src.'">'.$element->src.'</a><br>';
}
}
$text = strip_tags($text, '<p><b><a><blockquote><img><em><br/><br><ul><li>'); foreach($articleHTMLContent->find('iframe') as $element) {
return $text; if (preg_match("/youtube/i", $element->src)) {
} $text = $text . '// An IFRAME to Youtube was included in the article: <a href="' . $element->src . '">' . $element->src . '</a><br>';
}
}
$rssFeed = $this->file_get_html('http://www.journaldugeek.com/rss') or $this->returnError('Could not request http://www.journaldugeek.com/rss', 404); $text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $text);
$limit = 0; $text = strip_tags($text, '<p><b><a><blockquote><img><em><br/><br><ul><li>');
return $text;
}
foreach($rssFeed->find('item') as $element) { public function collectData(array $param){
if($limit < 5) { $rssFeed = $this->file_get_html('http://www.journaldugeek.com/rss') or $this->returnError('Could not request http://www.journaldugeek.com/rss', 404);
$item = new \Item(); $limit = 0;
$item->title = LeJournalDuGeekStripCDATA($element->find('title', 0)->innertext);
$item->uri = LeJournalDuGeekStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = LeJournalDuGeekExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
} foreach($rssFeed->find('item') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = $this->LeJournalDuGeekStripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->LeJournalDuGeekStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->LeJournalDuGeekExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){ public function getCacheDuration(){
return 'LeJournalDuGeek'; return 1800; // 30min
} }
public function getURI(){
return 'http://www.journaldugeek.com/';
}
public function getCacheDuration(){
return 1800; // 30min
}
} }

View file

@ -7,7 +7,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$this->name = "Le Monde Informatique"; $this->name = "Le Monde Informatique";
$this->uri = "http://www.lemondeinformatique.fr/"; $this->uri = "http://www.lemondeinformatique.fr/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-01-28"; $this->update = "2016-08-09";
} }
@ -45,14 +45,12 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6); $article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>')); $article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
$article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request LeMondeInformatique: '.$article_uri, 500); $article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request LeMondeInformatique: '.$article_uri, 500);
$thumbnailUri = $article_html->find('div#article', 0)->find('img#illustration', 0)->src;
$article_content = CleanArticle($article_html->find('div#article', 0)->innertext); $article_content = CleanArticle($article_html->find('div#article', 0)->innertext);
$article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext; $article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext;
//Build and add final item //Build and add final item
$item = new \Item(); $item = new \Item();
$item->uri = $article_uri; $item->uri = $article_uri;
$item->thumbnailUri = $thumbnailUri;
$item->title = $article_title; $item->title = $article_title;
$item->author = StripCDATA($element->find('dc:creator', 0)->innertext); $item->author = StripCDATA($element->find('dc:creator', 0)->innertext);
$item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); $item->timestamp = strtotime($element->find('dc:date', 0)->plaintext);
@ -63,14 +61,6 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
} }
} }
public function getName() {
return 'Le Monde Informatique';
}
public function getURI() {
return 'http://www.lemondeinformatique.fr/';
}
public function getCacheDuration() { public function getCacheDuration() {
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -1,55 +0,0 @@
<?php
class LeMotDuJourBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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){
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.single-contenu', 0)->innertext;
return $text;
}
$html = $this->file_get_html('http://feeds2.feedburner.com/lemotdujour/lemotdujour') or $this->returnError('Could not request LeMotDuJour.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 10) {
$item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'LeMotDuJour Bridge';
}
public function getURI(){
return 'http://lemotdujour.com/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
// return 0; // 2 hours
}
}

View file

@ -10,7 +10,7 @@ class Les400Culs extends RssExpander{
$this->name = "Les 400 Culs"; $this->name = "Les 400 Culs";
$this->uri = "http://sexes.blogs.liberation.fr"; $this->uri = "http://sexes.blogs.liberation.fr";
$this->description = "La planete sexe vue par Agnes Girard via rss-bridge"; $this->description = "La planete sexe vue par Agnes Girard via rss-bridge";
$this->update = "20/02/2014"; $this->update = "2016-08-09";
} }
@ -34,7 +34,7 @@ class Les400Culs extends RssExpander{
// $content = $articlePage->find('.post-container', 0); // $content = $articlePage->find('.post-container', 0);
$item->content = (string) $newsItem->description; $item->content = (string) $newsItem->description;
$item->name = (string) $newsItem->author; $item->author = (string) $newsItem->author;
$item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); $item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem);
return $item; return $item;
} }

View file

@ -7,7 +7,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
$this->name = "Les Joies Du Code"; $this->name = "Les Joies Du Code";
$this->uri = "http://lesjoiesducode.fr/"; $this->uri = "http://lesjoiesducode.fr/";
$this->description = "LesJoiesDuCode"; $this->description = "LesJoiesDuCode";
$this->update = "04/02/2015"; $this->update = "2016-08-09";
} }
@ -36,7 +36,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
if($pos > 0) if($pos > 0)
{ {
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2)))); $auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
$item->name = $auteur; $item->author = $auteur;
} }
@ -48,19 +48,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'Les Joies Du Code';
}
public function getURI(){
return 'http://lesjoiesducode.fr/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 7200; // 2h hours return 7200; // 2h hours
} }
public function getDescription(){
return "Les Joies Du Code via rss-bridge";
}
} }
?>

View file

@ -5,10 +5,10 @@ class LichessBridge extends BridgeAbstract
public function loadMetadatas() public function loadMetadatas()
{ {
$this->maintainer = 'AmauryCarrade'; $this->maintainer = 'AmauryCarrade';
$this->name = $this->getName() . ' Bridge'; $this->name = 'Lichess Blog';
$this->uri = $this->getURI(); $this->uri = 'http://lichess.org/blog';
$this->description = 'Returns the 5 newest posts from the Lichess blog (full text)'; $this->description = 'Returns the 5 newest posts from the Lichess blog (full text)';
$this->update = "2016-03-22"; $this->update = "2016-08-06";
} }
public function collectData(array $param) public function collectData(array $param)
@ -48,14 +48,4 @@ class LichessBridge extends BridgeAbstract
return $content; return $content;
} }
public function getName()
{
return 'Lichess Blog';
}
public function getURI()
{
return 'http://lichess.org/blog';
}
} }

View file

@ -7,7 +7,7 @@ class LinkedInCompany extends BridgeAbstract{
$this->name = "LinkedIn Company"; $this->name = "LinkedIn Company";
$this->uri = "https://www.linkedin.com/"; $this->uri = "https://www.linkedin.com/";
$this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)"; $this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)";
$this->update = "2015-12-22"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -31,21 +31,12 @@ class LinkedInCompany extends BridgeAbstract{
$item->uri = $link; $item->uri = $link;
$item->title = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100); $item->title = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100);
$item->content = strip_tags($element->find('span.share-body', 0)->innertext); $item->content = strip_tags($element->find('span.share-body', 0)->innertext);
$item->thumbnailUri = htmlspecialchars_decode($element->find('img', 0)->attr['data-li-lazy-load-src']);
$this->items[] = $item; $this->items[] = $item;
$i++; $i++;
} }
} }
} }
public function getName(){
return 'LinkedIn';
}
public function getURI(){
return 'https://www.linkedin.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -7,7 +7,7 @@ class LolibooruBridge extends BridgeAbstract{
$this->name = "Lolibooru"; $this->name = "Lolibooru";
$this->uri = "http://lolibooru.moe/"; $this->uri = "http://lolibooru.moe/";
$this->description = "Returns images from given page and tags"; $this->description = "Returns images from given page and tags";
$this->update = "2015-03-21"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -45,21 +45,12 @@ class LolibooruBridge extends BridgeAbstract{
$item->postid = $json['id']; $item->postid = $json['id'];
$item->timestamp = $json['created_at']; $item->timestamp = $json['created_at'];
$item->imageUri = $json['file_url']; $item->imageUri = $json['file_url'];
$item->thumbnailUri = $json['preview_url'];
$item->title = 'Lolibooru | '.$json['id']; $item->title = 'Lolibooru | '.$json['id'];
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$json['tags']; $item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Lolibooru';
}
public function getURI(){
return 'http://lolibooru.moe/post';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -1,60 +0,0 @@
<?php
class MalikiBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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 = $this->file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404);
$count=0;
$latest=1; $latest_title="";
$latest = $html->find('div.conteneur_page a', 1)->href;
$latest_title = $html->find('div.conteneur_page img', 0)->title;
function MalikiExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = 'http://www.maliki.com/'.$html2->find('img', 0)->src;
$text = '<img alt="" src="'.$text.'"/><br>'.$html2->find('div.imageetnews', 0)->plaintext;
return $text;
}
$item = new \Item();
$item->uri = 'http://www.maliki.com/'.$latest;
$item->title = $latest_title;
$item->timestamp = time();
$item->content = MalikiExtractContent($item->uri);
$this->items[] = $item;
foreach($html->find('div.boite_strip') as $element) {
if(!empty($element->find('a',0)->href) and $count < 3) {
$item = new \Item();
$item->uri = 'http://www.maliki.com/'.$element->find('a',0)->href;
$item->title = $element->find('img',0)->title;
$item->timestamp = strtotime(str_replace('/', '-', $element->find('span.stylepetit', 0)->innertext));
$item->content = MalikiExtractContent($item->uri);
$this->items[] = $item;
$count++;
}
}
}
public function getName(){
return 'Maliki';
}
public function getURI(){
return 'http://www.maliki.com/';
}
public function getCacheDuration(){
return 86400*6; // 6 days
}
}

View file

@ -8,7 +8,7 @@ class MangareaderBridge extends BridgeAbstract{
$this->name = "Mangareader Bridge"; $this->name = "Mangareader Bridge";
$this->uri = "http://www.mangareader.net"; $this->uri = "http://www.mangareader.net";
$this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; $this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)";
$this->update = "2016-01-22"; $this->update = "2016-08-09";
$this->parameters["Get latest updates"] = '[]'; $this->parameters["Get latest updates"] = '[]';
$this->parameters["Get popular mangas"] = $this->parameters["Get popular mangas"] =
@ -281,15 +281,15 @@ class MangareaderBridge extends BridgeAbstract{
// The thumbnail is encrypted in a css-style... // The thumbnail is encrypted in a css-style...
// format: "background-image:url('<the part which is actually interesting>')" // format: "background-image:url('<the part which is actually interesting>')"
$mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style');
$thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24);
$item = new \Item(); $item = new \Item();
$item->title = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue); $item->title = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue);
$item->uri = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); $item->uri = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href');
$item->author = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue); $item->author = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue);
$item->chaptercount = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; $item->chaptercount = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue;
$item->genre = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue); $item->genre = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue);
$item->thumbnailUri = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24); $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnail . '" alt="' . $item->title . '" /></a><p>' . $item->genre . '</p><p>' . $item->chaptercount . '</p>';
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" alt="' . $item->title . '" /></a><p>' . $item->genre . '</p><p>' . $item->chaptercount . '</p>';
$this->items[] = $item; $this->items[] = $item;
} }
} }
@ -328,10 +328,6 @@ class MangareaderBridge extends BridgeAbstract{
return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge'; return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge';
} }
public function getURI(){
return 'http://www.mangareader.net';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 10800; // 3 hours return 10800; // 3 hours
} }

View file

@ -1,58 +0,0 @@
<?php
class MemoLinuxBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.entry-content', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
$text = preg_replace('@<div[^>]*?>.*?</div>@si', '', $text);
$text = preg_replace("/<h1.*/", '', $text);
return $text;
}
$html = $this->file_get_html('http://memo-linux.com/feed/') or $this->returnError('Could not request MemoLinux.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 10) {
$item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'MemoLinux';
}
public function getURI(){
return 'http://memo-linux.com/feed/';
}
public function getCacheDuration(){
return 3600*12; // 12 hours
}
}

View file

@ -7,7 +7,7 @@ class MilbooruBridge extends BridgeAbstract{
$this->name = "Milbooru"; $this->name = "Milbooru";
$this->uri = "http://sheslostcontrol.net/moe/shimmie/"; $this->uri = "http://sheslostcontrol.net/moe/shimmie/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -39,22 +39,14 @@ class MilbooruBridge extends BridgeAbstract{
$item->uri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href; $item->uri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id')); $item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id'));
$item->timestamp = time(); $item->timestamp = time();
$item->thumbnailUri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('img', 0)->src; $thumbnailUri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('img', 0)->src;
$item->tags = $element->find('a', 0)->getAttribute('data-tags'); $item->tags = $element->find('a', 0)->getAttribute('data-tags');
$item->title = 'Milbooru | '.$item->postid; $item->title = 'Milbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags; $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Milbooru';
}
public function getURI(){
return 'http://sheslostcontrol.net/moe/shimmie/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -2,59 +2,27 @@
class MondeDiploBridge extends BridgeAbstract{ class MondeDiploBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "Pitchoule"; $this->maintainer = "Pitchoule";
$this->name = "MondeDiplo"; $this->name = 'Monde Diplomatique';
$this->uri = "http://www.monde-diplomatique.fr"; $this->uri = 'http://www.monde-diplomatique.fr';
$this->description = "Returns most recent results from MondeDiplo."; $this->description = "Returns most recent results from MondeDiplo.";
$this->update = "2014-07-22"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ public function collectData(array $param){
$link = 'http://www.monde-diplomatique.fr'; $html = $this->file_get_html($this->uri) or $this->returnError('Could not request MondeDiplo. for : ' . $link , 404);
$html = $this->file_get_html($link) or $this->returnError('Could not request MondeDiplo. for : ' . $link , 404);
foreach($html->find('div.laune') as $element) {
$item = new Item();
$item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href;
$item->title = $element->find('h3', 0)->plaintext;
$item->content = $element->find('div.dates_auteurs', 0)->plaintext. '<br>' .strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
$this->items[] = $item;
}
$liste = $html->find('div.listes', 0); // First list foreach($html->find('div.unarticle') as $article) {
foreach ($liste->find('li') as $e) { $element = $article->parent();
$item = new Item();
$item = new Item(); $item->uri = $this->uri . $element->href;
$item->uri = 'http://www.monde-diplomatique.fr' . $e->find('a', 0)->href; $item->title = $element->find('h3', 0)->plaintext;
$item->title = $e->find('a', 0)->plaintext; $item->content = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
$item->content = $e->find('div.dates_auteurs', 0)->plaintext; $this->items[] = $item;
$this->items[] = $item; }
} }
foreach($html->find('div.liste ul li') as $element) { public function getCacheDuration(){
if ($element->getAttribute('class') != 'intrapub') { return 21600; // 6 hours
$item = new Item(); }
$item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href;
$item->title = $element->find('h3', 0)->plaintext;
$item->content = $element->find('div.dates_auteurs', 0)->plaintext . ' <br> ' . $element->find('div.intro', 0)->plaintext;
$this->items[] = $item;
}
}
}
public function getName(){
return 'Monde Diplomatique';
}
public function getURI(){
return 'http://www.monde-diplomatique.fr';
}
public function getCacheDuration(){
return 21600; // 6 hours
}
} }

View file

@ -2,46 +2,31 @@
class MsnMondeBridge extends BridgeAbstract{ class MsnMondeBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "kranack"; $this->maintainer = "kranack";
$this->name = "MSN Actu Monde"; $this->name = 'MSN Actu Monde';
$this->uri = "http://www.msn.com/fr-fr/actualite/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->description = "Returns the 10 newest posts from MSN Actualités (full text)";
$this->update = "2015-01-30"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function MsnMondeExtractContent($url, &$item) {
$html2 = $this->file_get_html($url);
$item->content = $html2->find('#content', 0)->find('article', 0)->find('section', 0)->plaintext;
$item->timestamp = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime);
}
function MsnMondeExtractContent($url, &$item) { public function collectData(array $param){
$html2 = $this->file_get_html($url); $html = $this->file_get_html($this->uri) or $this->returnError('Could not request MsnMonde.', 404);
$item->content = $html2->find('#content', 0)->find('article', 0)->find('section', 0)->plaintext; $limit = 0;
$item->timestamp = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime); foreach($html->find('.smalla') as $article) {
} if($limit < 10) {
$item = new \Item();
$html = $this->file_get_html('http://www.msn.com/fr-fr/actualite/monde') or $this->returnError('Could not request MsnMonde.', 404); $item->title = utf8_decode($article->find('h4', 0)->innertext);
$limit = 0; $item->uri = "http://www.msn.com" . utf8_decode($article->find('a', 0)->href);
foreach($html->find('.smalla') as $article) { $this->MsnMondeExtractContent($item->uri, $item);
if($limit < 10) { $this->items[] = $item;
$item = new \Item(); $limit++;
$item->title = utf8_decode($article->find('h4', 0)->innertext); }
$item->uri = "http://www.msn.com" . utf8_decode($article->find('a', 0)->href); }
MsnMondeExtractContent($item->uri, $item); }
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'MSN Actu Monde';
}
public function getURI(){
return 'http://www.msn.com/fr-fr/actualite/monde';
}
public function getCacheDuration(){
return 3600; // 1 hour
}
} }

View file

@ -7,7 +7,7 @@ class MspabooruBridge extends BridgeAbstract{
$this->name = "Mspabooru"; $this->name = "Mspabooru";
$this->uri = "http://mspabooru.com/"; $this->uri = "http://mspabooru.com/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2014-05-25"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -42,22 +42,14 @@ class MspabooruBridge extends BridgeAbstract{
$item->uri = 'http://mspabooru.com/'.$element->find('a', 0)->href; $item->uri = 'http://mspabooru.com/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time(); $item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt'); $item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Mspabooru | '.$item->postid; $item->title = 'Mspabooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags; $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'Mspabooru';
}
public function getURI(){
return 'http://mspabooru.com/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 1800; // 30 minutes return 1800; // 30 minutes
} }

View file

@ -3,10 +3,10 @@ class NakedSecurityBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = 'ORelio'; $this->maintainer = 'ORelio';
$this->name = $this->getName(); $this->name = 'Naked Security';
$this->uri = $this->getURI(); $this->uri = 'https://nakedsecurity.sophos.com/';
$this->description = 'Returns the newest articles.'; $this->description = 'Returns the newest articles.';
$this->update = '2016-04-30'; $this->update = '2016-08-09';
} }
public function collectData(array $param) { public function collectData(array $param) {
@ -60,7 +60,6 @@ class NakedSecurityBridge extends BridgeAbstract {
$item = new \Item(); $item = new \Item();
$item->uri = $article_uri; $item->uri = $article_uri;
$item->title = $article_title; $item->title = $article_title;
$item->thumbnailUri = $article_image;
$item->author = $article_html->find('a[rel=author]', 0)->plaintext; $item->author = $article_html->find('a[rel=author]', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $article_content; $item->content = $article_content;
@ -69,16 +68,4 @@ class NakedSecurityBridge extends BridgeAbstract {
} }
} }
} }
public function getName() {
return 'Naked Security';
}
public function getURI() {
return 'https://nakedsecurity.sophos.com/';
}
public function getCacheDuration() {
return 3600; //1 hour
}
} }

View file

@ -7,7 +7,7 @@ class NasaApodBridge extends BridgeAbstract{
$this->name = "NASA APOD Bridge"; $this->name = "NASA APOD Bridge";
$this->uri = "http://apod.nasa.gov/apod/astropix.html"; $this->uri = "http://apod.nasa.gov/apod/astropix.html";
$this->description = "Returns the 3 latest NASA APOD pictures and explanations"; $this->description = "Returns the 3 latest NASA APOD pictures and explanations";
$this->update = "2014-08-27"; $this->update = "2016-08-09";
} }
@ -45,14 +45,6 @@ class NasaApodBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'NASA APOD';
}
public function getURI(){
return 'http://apod.nasa.gov/apod/astropix.html';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 3600*12; // 12 hours return 3600*12; // 12 hours
} }

View file

@ -3,10 +3,10 @@ class NeuviemeArtBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "ORelio"; $this->maintainer = "ORelio";
$this->name = "9ème Art"; $this->name = '9ème Art Bridge';
$this->uri = "http://www.9emeart.fr/"; $this->uri = "http://www.9emeart.fr/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-02-05"; $this->update = "2016-08-09";
} }
public function collectData(array $param) { public function collectData(array $param) {
@ -46,7 +46,6 @@ class NeuviemeArtBridge extends BridgeAbstract {
$item = new \Item(); $item = new \Item();
$item->uri = $article_uri; $item->uri = $article_uri;
$item->title = $article_title; $item->title = $article_title;
$item->thumbnailUri = $element->find('enclosure', 0)->url;
$item->author = $article_html->find('a[class=upp transition_fast upp]', 0)->plaintext; $item->author = $article_html->find('a[class=upp transition_fast upp]', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $article_content; $item->content = $article_content;
@ -55,16 +54,4 @@ class NeuviemeArtBridge extends BridgeAbstract {
} }
} }
} }
}
public function getName() {
return '9ème Art Bridge';
}
public function getURI() {
return 'http://www.9emeart.fr/';
}
public function getCacheDuration() {
return 3600; //1 hour
}
}

View file

@ -2,63 +2,45 @@
class NextInpactBridge extends BridgeAbstract { class NextInpactBridge extends BridgeAbstract {
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "qwertygc"; $this->maintainer = "qwertygc";
$this->name = "NextInpact Bridge"; $this->name = "NextInpact Bridge";
$this->uri = "http://www.nextinpact.com/"; $this->uri = "http://www.nextinpact.com/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2015-10-23"; $this->update = "2016-08-09";
}
private function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
private function ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>'
.'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>'
.'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>';
$premium_article = $html2->find('h2.title_reserve_article', 0);
if (is_object($premium_article))
$text = $text.'<p><em>'.$premium_article->innertext.'</em></p>';
return $text;
} }
public function collectData(array $param) { public function collectData(array $param) {
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>'
.'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>'
.'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>';
$premium_article = $html2->find('h2.title_reserve_article', 0);
if (is_object($premium_article))
$text = $text.'<p><em>'.$premium_article->innertext.'</em></p>';
return $text;
}
$html = $this->file_get_html('http://www.nextinpact.com/rss/news.xml') or $this->returnError('Could not request NextInpact.', 404); $html = $this->file_get_html('http://www.nextinpact.com/rss/news.xml') or $this->returnError('Could not request NextInpact.', 404);
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 3) { if($limit < 3) {
$item = new \Item(); $item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext); $item->title = $this->StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext); $item->uri = $this->StripCDATA($element->find('guid', 0)->plaintext);
$item->thumbnailUri = StripCDATA($element->find('enclosure', 0)->url); $item->author = $this->StripCDATA($element->find('creator', 0)->innertext);
$item->author = StripCDATA($element->find('author', 0)->innertext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri); $item->content = $this->ExtractContent($item->uri);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }
} }
}
public function getName() {
return 'Nextinpact Bridge';
}
public function getURI() {
return 'http://www.nextinpact.com/';
}
public function getCacheDuration() {
return 3600; // 1 hour
// return 0;
} }
} }

94
bridges/NextgovBridge.php Normal file
View file

@ -0,0 +1,94 @@
<?php
class NextgovBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = 'ORelio';
$this->name = 'Nextgov Bridge';
$this->uri = 'https://www.nextgov.com/';
$this->description = 'USA Federal technology news, best practices, and web 2.0 tools.';
$this->update = '2016-08-09';
$this->parameters[] =
'[
{
"name" : "Category",
"type" : "list",
"identifier" : "category",
"values" :
[
{ "name" : "All", "value" : "all" },
{ "name" : "Technology News", "value" : "technology-news" },
{ "name" : "CIO Briefing", "value" : "cio-briefing" },
{ "name" : "Emerging Tech", "value" : "emerging-tech" },
{ "name" : "Cloud", "value" : "cloud-computing" },
{ "name" : "Cybersecurity", "value" : "cybersecurity" },
{ "name" : "Mobile", "value" : "mobile" },
{ "name" : "Health", "value" : "health" },
{ "name" : "Defense", "value" : "defense" },
{ "name" : "Big Data", "value" : "big-data" }
]
}
]';
}
public function collectData(array $param) {
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) {
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
$category = $param['category'];
if (empty($category))
$category = 'all';
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))
$this->returnError('Invalid "category" parameter.', 400);
$url = $this->getURI().'rss/'.$category.'/';
$html = $this->file_get_html($url) or $this->returnError('Could not request Nextgov: '.$url, 500);
$limit = 0;
foreach ($html->find('item') as $element) {
if ($limit < 10) {
$article_url = ExtractFromDelimiters($element->innertext, '<link>', '</link>');
$article_author = ExtractFromDelimiters($element->innertext, 'dc/elements/1.1/">', '</dc:creator>');
$article_title = $element->find('title', 0)->plaintext;
$article_subtitle = $element->find('description', 0)->plaintext;
$article_timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$article_thumbnail = ExtractFromDelimiters($element->innertext, '<media:content url="', '"');
$article = $this->file_get_html($article_url) or $this->returnError('Could not request Nextgov: '.$article_url, 500);
$contents = $article->find('div.wysiwyg', 0)->innertext;
$contents = StripWithDelimiters($contents, '<div class="ad-container">', '</div>');
$contents = StripWithDelimiters($contents, '<div', '</div>'); //ad outer div
$contents = StripWithDelimiters($contents, '<script', '</script>');
$contents = ($article_thumbnail == '' ? '' : '<p><img src="'.$article_thumbnail.'" /></p>')
.'<p><b>'.$article_subtitle.'</b></p>'
.trim($contents);
$item = new \Item();
$item->uri = $article_url;
$item->title = $article_title;
$item->author = $article_author;
$item->timestamp = $article_timestamp;
$item->content = $contents;
$this->items[] = $item;
$limit++;
}
}
}
}

View file

@ -2,61 +2,47 @@
class NiceMatinBridge extends BridgeAbstract{ class NiceMatinBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "pit-fgfjiudghdf"; $this->maintainer = "pit-fgfjiudghdf";
$this->name = "NiceMatin"; $this->name = "NiceMatin";
$this->uri = "http://www.nicematin.com/"; $this->uri = "http://www.nicematin.com/";
$this->description = "Returns the 10 newest posts from NiceMatin (full text)"; $this->description = "Returns the 10 newest posts from NiceMatin (full text)";
$this->update = "2014-05-26"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function NiceMatinExtractContent($url) {
$html = $this->file_get_html($url);
if(!$html)
$this->returnError('Could not acquire content from url: ' . $url . '!', 404);
$content = $html->find('article', 0);
if(!$content)
$this->returnError('Could not find \'section\'!', 404);
$text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content->innertext);
$text = strip_tags($text, '<p><a><img>');
return $text;
}
function NiceMatinUrl($string) { public function collectData(array $param){
$string = str_replace('</link>', '', $string); $html = $this->file_get_html('http://www.nicematin.com/derniere-minute/rss') or $this->returnError('Could not request NiceMatin.', 404);
//$string = str_replace('.+', '', $string); $limit = 0;
$string = preg_replace('/html.*http.*/i','html',$string);
$string = preg_replace('/.*http/i','http',$string);
return $string;
}
function NiceMatinExtractContent($url) { foreach($html->find('item') as $element) {
$html2 = $this->file_get_html($url); if($limit < 10) {
$text = $html2->find('figure[itemprop=associatedMedia]', 0)->innertext; // We need to fix the 'link' tag as simplehtmldom cannot parse it (just rename it and load back as dom)
$text .= $html2->find('div[id=content-article]', 0)->innertext; $element_text = $element->outertext;
return $text; $element_text = str_replace('<link>', '<url>', $element_text);
} $element_text = str_replace('</link>', '</url>', $element_text);
$element = str_get_html($element_text);
$html = $this->file_get_html('http://www.nicematin.com/derniere-minute/rss') or $this->returnError('Could not request NiceMatin.', 404); $item = new \Item();
$limit = 0; $item->title = $element->find('title', 0)->innertext;
$item->uri = $element->find('url', 0)->innertext;
foreach($html->find('item') as $element) { $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
if($limit < 10) { $item->content = $this->NiceMatinExtractContent($item->uri);
$item = new \Item(); $this->items[] = $item;
//$item->title = NiceMatinStripCDATA($element->find('title', 0)->innertext); $limit++;
$item->title = $element->find('title', 0)->innertext; }
$item->uri = NiceMatinUrl($element->plaintext); }
}
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = NiceMatinExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'NiceMatin';
}
public function getURI(){
return 'http://www.nicematin.com/';
}
public function getCacheDuration(){
return 3600; // 1 hour
}
} }

View file

@ -7,7 +7,7 @@ class NovelUpdatesBridge extends BridgeAbstract{
$this->name = "Novel Updates"; $this->name = "Novel Updates";
$this->uri = "http://www.novelupdates.com/"; $this->uri = "http://www.novelupdates.com/";
$this->description = "Returns releases from Novel Updates"; $this->description = "Returns releases from Novel Updates";
$this->update = "2016-05-21"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
{ {
@ -44,15 +44,11 @@ class NovelUpdatesBridge extends BridgeAbstract{
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){ public function getName(){
return (!empty($this->request) ? $this->request.' - ' : '') .'Novel Updates'; return (!empty($this->request) ? $this->request.' - ' : '') .'Novel Updates';
} }
public function getURI(){
return 'http://www.novelupdates.com/';
}
public function getDescription(){
return "Novel Updates - Directory of Translated Novels";
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -7,7 +7,7 @@ class NumeramaBridge extends BridgeAbstract{
$this->name = 'Numerama'; $this->name = 'Numerama';
$this->uri = 'http://www.numerama.com/'; $this->uri = 'http://www.numerama.com/';
$this->description = 'Returns the 5 newest posts from Numerama (full text)'; $this->description = 'Returns the 5 newest posts from Numerama (full text)';
$this->update = '2016-07-19'; $this->update = '2016-08-09';
} }
@ -19,7 +19,7 @@ class NumeramaBridge extends BridgeAbstract{
return $string; return $string;
} }
$feed = $this->getURI().'feed/'; $feed = $this->uri.'feed/';
$html = $this->file_get_html($feed) or $this->returnError('Could not request Numerama: '.$feed, 500); $html = $this->file_get_html($feed) or $this->returnError('Could not request Numerama: '.$feed, 500);
$limit = 0; $limit = 0;
@ -45,14 +45,6 @@ class NumeramaBridge extends BridgeAbstract{
} }
public function getName() {
return 'Numerama';
}
public function getURI() {
return 'http://www.numerama.com/';
}
public function getCacheDuration() { public function getCacheDuration() {
return 1800; // 30min return 1800; // 30min
} }

View file

@ -7,7 +7,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
$this->name = "OpenClassrooms Bridge"; $this->name = "OpenClassrooms Bridge";
$this->uri = "https://openclassrooms.com/"; $this->uri = "https://openclassrooms.com/";
$this->description = "Returns latest tutorials from OpenClassrooms."; $this->description = "Returns latest tutorials from OpenClassrooms.";
$this->update = "2015-10-30"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
@ -79,14 +79,6 @@ class OpenClassroomsBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'OpenClassrooms';
}
public function getURI(){
return 'https://openclassrooms.com/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -1,56 +0,0 @@
<?php
class OpenTheoryBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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){
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.entry-content', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
return $text;
}
$html = $this->file_get_html('http://open1theory.com/feed') or $this->returnError('Could not request OpenTheory.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'OpenTheory';
}
public function getURI(){
return 'http://open1theory.com/feed';
}
public function getCacheDuration(){
return 3600; // 1 hour
// return 0; // 1 hour
}
}

View file

@ -8,9 +8,9 @@ class ParuVenduImmoBridge extends BridgeAbstract
$this->maintainer = "polo2ro"; $this->maintainer = "polo2ro";
$this->name = "Paru Vendu Immobilier"; $this->name = "Paru Vendu Immobilier";
$this->uri = "http://www.paruvendu.fr/immobilier/"; $this->uri = "http://www.paruvendu.fr";
$this->description = "Returns the ads from the first page of search result."; $this->description = "Returns the ads from the first page of search result.";
$this->update = "2015-02-02"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
@ -46,7 +46,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
$num = 20; $num = 20;
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1'; $appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1'; $maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
$link = $this->getURI().'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison; $link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
if (isset($param['minarea'])) { if (isset($param['minarea'])) {
$this->request .= ' '.$param['minarea'].' m2'; $this->request .= ' '.$param['minarea'].' m2';
@ -90,7 +90,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
list($href) = explode('#', $element->href); list($href) = explode('#', $element->href);
$item = new \Item(); $item = new \Item();
$item->uri = $this->getURI().$href; $item->uri = $this->uri.$href;
$item->title = $element->title; $item->title = $element->title;
$item->content = $img.$desc.$price; $item->content = $img.$desc.$price;
$this->items[] = $item; $this->items[] = $item;
@ -102,10 +102,6 @@ class ParuVenduImmoBridge extends BridgeAbstract
return 'Paru Vendu Immobilier'.$this->request; return 'Paru Vendu Immobilier'.$this->request;
} }
public function getURI(){
return 'http://www.paruvendu.fr';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 10800; // 3 hours return 10800; // 3 hours
} }

View file

@ -11,7 +11,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
$this->name = "PickyWallpapers Bridge"; $this->name = "PickyWallpapers Bridge";
$this->uri = "http://www.pickywallpapers.com/"; $this->uri = "http://www.pickywallpapers.com/";
$this->description = "Returns the latests wallpapers from PickyWallpapers"; $this->description = "Returns the latests wallpapers from PickyWallpapers";
$this->update = "2014-03-31"; $this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -68,7 +68,6 @@ class PickyWallpapersBridge extends BridgeAbstract {
$item->uri = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src); $item->uri = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src);
$item->timestamp = time(); $item->timestamp = time();
$item->title = $element->alt; $item->title = $element->alt;
$item->thumbnailUri = $element->src;
$item->content = $item->title.'<br><a href="'.$item->uri.'">'.$element.'</a>'; $item->content = $item->title.'<br><a href="'.$item->uri.'">'.$element.'</a>';
$this->items[] = $item; $this->items[] = $item;
@ -84,10 +83,6 @@ class PickyWallpapersBridge extends BridgeAbstract {
return 'PickyWallpapers - '.$this->category.(!empty($this->subcategory) ? ' > '.$this->subcategory : '').' ['.$this->resolution.']'; return 'PickyWallpapers - '.$this->category.(!empty($this->subcategory) ? ' > '.$this->subcategory : '').' ['.$this->resolution.']';
} }
public function getURI(){
return 'http://www.pickywallpapers.com';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 43200; // 12 hours return 43200; // 12 hours
} }

View file

@ -9,9 +9,9 @@ class PinterestBridge extends BridgeAbstract{
$this->maintainer = "pauder"; $this->maintainer = "pauder";
$this->name = "Pinterest Bridge"; $this->name = "Pinterest Bridge";
$this->uri = "http://www.pinterest.com/"; $this->uri = "http://www.pinterest.com";
$this->description = "Returns the newest images on a board"; $this->description = "Returns the newest images on a board";
$this->update = "2014-05-25"; $this->update = "2016-08-06";
$this->parameters["By username and board"] = $this->parameters["By username and board"] =
'[ '[
@ -110,12 +110,4 @@ class PinterestBridge extends BridgeAbstract{
return $this->username .' - '. $this->board.' - Pinterest'; return $this->username .' - '. $this->board.' - Pinterest';
} }
} }
public function getURI(){
return 'http://www.pinterest.com';
}
public function getCacheDuration(){
return 3600;
}
} }

View file

@ -1,46 +1,37 @@
<?php <?php
class PlanetLibreBridge extends BridgeAbstract{ class PlanetLibreBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas(){
$this->maintainer = "pit-fgfjiudghdf"; $this->maintainer = "pit-fgfjiudghdf";
$this->name = "PlanetLibre"; $this->name = "PlanetLibre";
$this->uri = "http://www.planet-libre.org"; $this->uri = "http://www.planet-libre.org";
$this->description = "Returns the 5 newest posts from PlanetLibre (full text)"; $this->description = "Returns the 5 newest posts from PlanetLibre (full text)";
$this->update = "2014-05-26"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function PlanetLibreExtractContent($url){
$html2 = $this->file_get_html($url);
$text = $html2->find('div[class="post-text"]', 0)->innertext;
return $text;
}
function PlanetLibreExtractContent($url) { public function collectData(array $param){
$html2 = $this->file_get_html($url); $html = $this->file_get_html('http://www.planet-libre.org/') or $this->returnError('Could not request PlanetLibre.', 404);
$text = $html2->find('div[class="post-text"]', 0)->innertext; $limit = 0;
return $text; foreach($html->find('div.post') as $element) {
} if($limit < 5) {
$html = $this->file_get_html('http://www.planet-libre.org/') or $this->returnError('Could not request PlanetLibre.', 404); $item = new \Item();
$limit = 0; $item->title = $element->find('h1', 0)->plaintext;
foreach($html->find('div.post') as $element) { $item->uri = $element->find('a', 0)->href;
if($limit < 5) { $item->timestamp = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext));
$item = new \Item(); $item->content = $this->PlanetLibreExtractContent($item->uri);
$item->title = $element->find('h1', 0)->plaintext; $this->items[] = $item;
$item->uri = $element->find('a', 0)->href; $limit++;
$item->timestamp = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext)); }
$item->content = PlanetLibreExtractContent($item->uri); }
$this->items[] = $item; }
$limit++;
}
}
} public function getCacheDuration(){
public function getName(){ return 3600*2; // 1 hour
return 'PlanetLibre'; }
}
public function getURI(){
return 'http://www.planet-libre.org/';
}
public function getCacheDuration(){
return 3600*2; // 1 hour
}
} }

View file

@ -7,7 +7,7 @@ class ProjectMGameBridge extends BridgeAbstract{
$this->name = "Project M Game Bridge"; $this->name = "Project M Game Bridge";
$this->uri = "http://projectmgame.com/en/"; $this->uri = "http://projectmgame.com/en/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2014-08-27"; $this->update = "2016-08-09";
} }
@ -33,14 +33,6 @@ class ProjectMGameBridge extends BridgeAbstract{
} }
} }
public function getName(){
return 'Project M Game Bridge';
}
public function getURI(){
return 'http://projectmgame.com/en/';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 10800; //3 hours return 10800; //3 hours
} }

View file

@ -5,6 +5,7 @@ class RTBFBridge extends BridgeAbstract {
$this->uri = "http://www.rtbf.be/auvio/emissions"; $this->uri = "http://www.rtbf.be/auvio/emissions";
$this->description = "Returns the newest RTBF videos by series ID"; $this->description = "Returns the newest RTBF videos by series ID";
$this->maintainer = "Frenzie"; $this->maintainer = "Frenzie";
$this->update = "2016-08-09";
$this->parameters[] = $this->parameters[] =
'[ '[
@ -26,17 +27,17 @@ class RTBFBridge extends BridgeAbstract {
if (isset($param['c'])) { if (isset($param['c'])) {
$html = $this->file_get_html('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']) or $this->returnError('Could not request RTBF.', 404); $html = $this->file_get_html('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']) or $this->returnError('Could not request RTBF.', 404);
foreach($html->find('.rtbf-media-grid article') as $element) { foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
if($count < $limit) { if($count < $limit) {
$item = new \Item(); $item = new \Item();
$item->id = $element->getAttribute('data-id'); $item->id = $element->getAttribute('data-id');
$item->uri = 'http://www.rtbf.be/auvio/detail?id='.$item->id; $item->uri = 'http://www.rtbf.be/auvio/detail?id='.$item->id;
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset')); $thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
$thumbnailUriLastSrc = end($thumbnailUriSrcSet); $thumbnailUriLastSrc = end($thumbnailUriSrcSet);
$item->thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0]; $thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
$item->title = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext); $item->title = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext);
$item->timestamp = strtotime($element->find('time', 0)->getAttribute('datetime')); $item->timestamp = strtotime($element->find('time', 0)->getAttribute('datetime'));
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>'; $item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a>';
$this->items[] = $item; $this->items[] = $item;
$count++; $count++;
} }
@ -51,10 +52,6 @@ class RTBFBridge extends BridgeAbstract {
return (!empty($this->request) ? $this->request .' - ' : '') .'RTBF Bridge'; return (!empty($this->request) ? $this->request .' - ' : '') .'RTBF Bridge';
} }
public function getURI(){
return 'http://www.rtbf.be/auvio/emissions';
}
public function getCacheDuration(){ public function getCacheDuration(){
return 21600; // 6 hours return 21600; // 6 hours
} }

View file

@ -1,53 +0,0 @@
<?php
class RaymondBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->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('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function raymondExtractContent($url) {
$html2 = $this->file_get_html($url);
$text = $html2->find('div.entry-content', 0)->innertext;
$text = preg_replace('/class="ad".*/', '', $text);
$text = strip_tags($text, '<p><a><i><strong><em><img>');
$text = str_replace('(adsbygoogle = window.adsbygoogle || []).push({});', '', $text);
return $text;
}
$html = $this->file_get_html('http://www.raymond.cc/blog/feed') or $this->returnError('Could not request raymond.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 3) {
$item = new \Item();
$item->title = raymondStripCDATA($element->find('title', 0)->innertext);
$item->uri = raymondStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = raymondExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'raymond';
}
public function getURI(){
return 'http://www.raymond.cc/blog';
}
public function getCacheDuration(){
return 3600*12; // 12 hour
}
}

View file

@ -7,7 +7,7 @@ class Releases3DSBridge extends BridgeAbstract {
$this->name = "3DS Scene Releases"; $this->name = "3DS Scene Releases";
$this->uri = "http://www.3dsdb.com/"; $this->uri = "http://www.3dsdb.com/";
$this->description = "Returns the newest scene releases."; $this->description = "Returns the newest scene releases.";
$this->update = "2015-09-17"; $this->update = "2016-08-09";
} }
@ -108,7 +108,6 @@ class Releases3DSBridge extends BridgeAbstract {
$item->title = $name; $item->title = $name;
$item->author = $publisher; $item->author = $publisher;
$item->timestamp = $ignDate; $item->timestamp = $ignDate;
$item->thumbnailUri = $ignCoverArt;
$item->uri = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink; $item->uri = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink;
$item->content = $ignDescription.$releaseDescription.$releaseSearchLinks; $item->content = $ignDescription.$releaseDescription.$releaseSearchLinks;
$this->items[] = $item; $this->items[] = $item;
@ -119,14 +118,6 @@ class Releases3DSBridge extends BridgeAbstract {
} }
} }
public function getName() {
return '3DS Scene Releases';
}
public function getURI() {
return 'http://www.3dsdb.com/';
}
public function getCacheDuration() { public function getCacheDuration() {
return 10800; //3 hours return 10800; //3 hours
} }

View file

@ -2,54 +2,44 @@
class ReporterreBridge extends BridgeAbstract{ class ReporterreBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "nyutag"; $this->maintainer = "nyutag";
$this->name = "Reporterre Bridge"; $this->name = "Reporterre Bridge";
$this->uri = "http://www.reporterre.net/"; $this->uri = "http://www.reporterre.net/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2015-04-07"; $this->update = "2016-08-09";
} }
public function collectData(array $param){ private function ExtractContentReporterre($url) {
$html2 = $this->file_get_html($url);
function ExtractContentReporterre($url) { foreach($html2->find('div[style=text-align:justify]') as $e) {
$html2 = $this->file_get_html($url); $text = $e->outertext;
foreach($html2->find('div[style=text-align:justify]') as $e) { }
$text = $e->outertext;
} $html2->clear();
$html2->clear(); unset ($html2);
unset ($html2);
return $text; // Replace all relative urls with absolute ones
$text = preg_replace('/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims', "$1$2" . $this->uri . "$3", $text);
$text = strip_tags($text, '<p><br><a><img>');
return $text;
} }
public function collectData(array $param){
$html = $this->file_get_html('http://www.reporterre.net/spip.php?page=backend') or $this->returnError('Could not request Reporterre.', 404); $html = $this->file_get_html('http://www.reporterre.net/spip.php?page=backend') or $this->returnError('Could not request Reporterre.', 404);
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = new \Item();
$item->title = html_entity_decode($element->find('title', 0)->plaintext); $item->title = html_entity_decode($element->find('title', 0)->plaintext);
$item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); $item->timestamp = strtotime($element->find('dc:date', 0)->plaintext);
$item->uri = $element->find('guid', 0)->innertext; $item->uri = $element->find('guid', 0)->innertext;
$item->content = html_entity_decode(ExtractContentReporterre($item->uri)); $item->content = html_entity_decode($this->ExtractContentReporterre($item->uri));
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }
} }
}
}
public function getName(){
return 'Reporterre Bridge';
}
public function getURI(){
return 'http://www.reporterre.net/';
}
public function getCacheDuration(){
return 3600; // 1 hours
// return 0;
}
} }

Some files were not shown because too many files have changed in this diff Show more