diff --git a/.travis.yml b/.travis.yml index 156a62fa..f191430c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: php php: - - '5.4' - - '5.5' - '5.6' - '7.0' - hhvm @@ -14,3 +12,10 @@ script: - phpenv rehash - phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p - phpunit -c tests/phpunit.xml + +matrix: + fast_finish: true + allow_failures: + - php: hhvm + - php: nightly + diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aee3bf8..a1a4fb49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,14 @@ Alpha 0.1 * Includes refactoring. * Unstable. -Alpha 0.2 (current development version) +Alpha 0.2 === ## Important changes * RSS-Bridge has been [UNLICENSED](UNLICENSE) * RSS-Bridge is now a community-managed project on [GitHub](https://github.com/rss-bridge/rss-bridge) * RSS-Bridge now has a [Wiki](https://github.com/rss-bridge/rss-bridge/wiki) +* RSS-Bridge now supports [Travis-CI](https://travis-ci.org) ## General changes * Added [CHANGELOG](CHANGELOG.md) (this file) @@ -21,19 +22,20 @@ Alpha 0.2 (current development version) * Added cache purging function (cache will be force-purged after 24 hours or as defined by bridge) * Added new format [MrssFormat](formats/MrssFormat.php) * Added parameter `author` - for display of the feed author name - to all formats -* Added new abstractions of the BridgeInterface: - - [HttpCachingBridgeAbstract](https://github.com/RSS-Bridge/rss-bridge/wiki/Bridge-API) - - [RssExpander](https://github.com/RSS-Bridge/rss-bridge/wiki/Bridge-API) +* Added new abstraction of the BridgeInterface: + - [FeedExpander](https://github.com/RSS-Bridge/rss-bridge/wiki/Bridge-API) * Added optional support for proxy usage on each individual bridge * Added support for [custom bridge parameter](https://github.com/RSS-Bridge/rss-bridge/wiki/BridgeAbstract#format-specifications) (text, number, list, checkbox) * Changed design of the welcome screen * Changed design of HtmlFormat * Changed behavior of debug mode: - Enable debug mode by placing a file called "DEBUG" in the root folder - - Debug mode automatically disables caching + - Debug mode automatically disables cache file loading * Changed implementation of bridges - see [Wiki](https://github.com/rss-bridge/rss-bridge/wiki) - - Changed comment-style metadata to public function [`loadMetadatas`](https://github.com/RSS-Bridge/rss-bridge/wiki/BridgeAbstract#the-loadmetadatas-function) + - Changed comment-style metadata to constants - Added support for multiple utilizations per bridge + - Changed the parameter loading algorithm to be loaded by RSS-Bridge core +* Improved checks for PHP version, configuration and extensions * Many bug fixes ## Modified Bridges @@ -46,7 +48,6 @@ Alpha 0.2 (current development version) * AcrimedBridge * AllocineFRBridge * AnimeUltimeBridge -* ArstechnicaBridge * Arte7Bridge * AskfmBridge * BandcampBridge @@ -80,17 +81,13 @@ Alpha 0.2 (current development version) * FlickrTagBridge * FootitoBridge * FourchanBridge -* Freenews * FuturaSciencesBridge * GBAtempBridge -* Gawker * GelbooruBridge * GiphyBridge * GithubIssueBridge -* GitlabCommitsBridge -* GizmodoFRBridge +* GizmodoBridge * GooglePlusPostBridge -* GuruMedBridge * HDWallpapersBridge * HentaiHavenBridge * IdenticaBridge @@ -102,33 +99,31 @@ Alpha 0.2 (current development version) * KununuBridge * LWNprevBridge * LeBonCoinBridge -* LeJournalDuGeekBridge +* LegifranceJOBridge * LeMondeInformatiqueBridge -* Les400Culs * LesJoiesDuCodeBridge * LichessBridge -* LinkedInCompany +* LinkedInCompanyBridge * LolibooruBridge * MangareaderBridge * MilbooruBridge +* MoebooruBridge * MondeDiploBridge * MsnMondeBridge * MspabooruBridge -* NakedSecurityBridge * NasaApodBridge * NeuviemeArtBridge * NextInpactBridge * NextgovBridge * NiceMatinBridge * NovelUpdatesBridge -* NumeramaBridge * OpenClassroomsBridge * ParuVenduImmoBridge * PickyWallpapersBridge * PinterestBridge * PlanetLibreBridge -* ProjectMGameBridge * RTBFBridge +* ReadComicsBridge * Releases3DSBridge * ReporterreBridge * Rue89Bridge @@ -139,9 +134,9 @@ Alpha 0.2 (current development version) * ScmbBridge * ScoopItBridge * SensCritiqueBridge -* Sexactu +* SexactuBridge * ShanaprojectBridge -* SiliconBridge +* Shimmie2Bridge * SoundcloudBridge * StripeAPIChangeLogBridge * SuperbWallpapersBridge @@ -150,22 +145,19 @@ Alpha 0.2 (current development version) * TbibBridge * TheCodingLoveBridge * TheHackerNewsBridge -* TheOatMealBridge * ThePirateBayBridge -* TwitchApiBridge * UnsplashBridge -* ViadeoCompany +* ViadeoCompanyBridge * VineBridge * VkBridge * WallpaperStopBridge +* WebfailBridge * WeLiveSecurityBridge * WhydBridge * WikipediaBridge * WordPressBridge -* WorldOfTanks +* WorldOfTanksBridge * XbooruBridge * YandereBridge * YoutubeBridge * ZDNetBridge -* ZatazBridge -* ZoneTelechargementBridge diff --git a/README.md b/README.md index c64302a1..729d6b15 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,9 @@ RSS-Bridge hashtag (#rss-bridge) search on Twitter, in ATOM format (as displayed Requirements === - * PHP 5.4 + * PHP 5.6, e.g. `AddHandler application/x-httpd-php56 .php` in `.htaccess` * `openssl` extension enabled in PHP config (`php.ini`) + * `allow_url_fopen=1` in `php.ini` Enabling/Disabling bridges === @@ -107,6 +108,9 @@ Patch/contributors : * [kraoc](https://github.com/kraoc) * [lagaisse](https://github.com/lagaisse) * [az5he6ch](https://github.com/az5he6ch) + * [niawag](https://github.com/niawag) + * [JeremyRand](https://github.com/JeremyRand) + * [mro](https://github.com/mro) Licenses === diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index 51a767a0..1e7e170c 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -1,14 +1,14 @@ getSimpleHTMLDOM('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnClientError('No results for this query.'); + $html = getSimpleHTMLDOM(static::URI.'tablatures/nouveautes.html') or returnClientError('No results for this query.'); $table = $html->find('table#myTable', 0)->children(1); foreach ($table->find('tr') as $tab) @@ -17,8 +17,8 @@ class ABCTabsBridge extends BridgeAbstract{ $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['content'] = 'Le ' . $tab->find('td', 0)->plaintext . '
Par: ' . $tab->find('td', 5)->plaintext . '
Type: ' . $tab->find('td', 3)->plaintext; - $item['id'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); - $item['uri'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); + $item['id'] = static::URI . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); + $item['uri'] = static::URI . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); $this->items[] = $item; } } diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index a0bf4551..31481adf 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -1,42 +1,25 @@ collectExpandableDatas("http://www.acrimed.org/spip.php?page=backend"); - - } - - protected function parseRSSItem($newsItem) { - - $hs = new HTMLSanitizer(); - - $namespaces = $newsItem->getNameSpaces(true); - $dc = $newsItem->children($namespaces['dc']); - - $item = array(); - $item['uri'] = trim($newsItem->link); - $item['title'] = trim($newsItem->title); - $item['timestamp'] = strtotime($dc->date); - - $articlePage = $this->getSimpleHTMLDOM($newsItem->link); - $article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext); - $article = HTMLSanitizer::defaultImageSrcTo($article, "http://www.acrimed.org/"); - - $item['content'] = $article; - - - return $item; - - } - - public function getCacheDuration(){ - return 4800; // 2 hours + public function collectData(){ + $this->collectExpandableDatas(static::URI.'spip.php?page=backend'); } + + protected function parseItem($newsItem){ + $item = parent::parseItem($newsItem); + + $articlePage = getSimpleHTMLDOM($newsItem->link); + $article = sanitize($articlePage->find('article.article1', 0)->innertext); + $article = defaultImageSrcTo($article, static::URI); + $item['content'] = $article; + + return $item; + } + } diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php index f180f5d1..7f8c6e88 100644 --- a/bridges/AllocineFRBridge.php +++ b/bridges/AllocineFRBridge.php @@ -2,11 +2,12 @@ class AllocineFRBridge extends BridgeAbstract{ - public $maintainer = "superbaillot.net"; - public $name = "Allo Cine Bridge"; - public $uri = "http://www.allocine.fr"; - public $description = "Bridge for allocine.fr"; - public $parameters = array( array( + const MAINTAINER = "superbaillot.net"; + const NAME = "Allo Cine Bridge"; + const CACHE_TIMEOUT = 25200; // 7h + const URI = "http://www.allocine.fr/"; + const DESCRIPTION = "Bridge for allocine.fr"; + const PARAMETERS = array( array( 'category'=>array( 'name'=>'category', 'type'=>'list', @@ -24,13 +25,13 @@ class AllocineFRBridge extends BridgeAbstract{ public function getURI(){ switch($this->getInput('category')){ case 'faux-raccord': - $uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/'; + $uri = static::URI.'video/programme-12284/saison-27129/'; break; case 'top-5': - $uri = 'http://www.allocine.fr/video/programme-12299/saison-22542/'; + $uri = static::URI.'video/programme-12299/saison-29561/'; break; case 'tueurs-en-serie': - $uri = 'http://www.allocine.fr/video/programme-12286/saison-22938/'; + $uri = static::URI.'video/programme-12286/saison-22938/'; break; } @@ -38,21 +39,21 @@ class AllocineFRBridge extends BridgeAbstract{ } public function getName(){ - return $this->name.' : ' + return self::NAME.' : ' .array_search( $this->getInput('category'), - $this->parameters[$this->queriedContext]['category']['values'] + self::PARAMETERS[$this->queriedContext]['category']['values'] ); } public function collectData(){ - $html = $this->getSimpleHTMLDOM($this->getURI()) - or $this->returnServerError("Could not request ".$this->getURI()." !"); + $html = getSimpleHTMLDOM($this->getURI()) + or returnServerError("Could not request ".$this->getURI()." !"); $category=array_search( $this->getInput('category'), - $this->parameters[$this->queriedContext]['category']['values'] + self::PARAMETERS[$this->queriedContext]['category']['values'] ); @@ -66,19 +67,16 @@ class AllocineFRBridge extends BridgeAbstract{ 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); + $content = str_replace('src="/', 'src="'.static::URI, $content); + $content = str_replace('href="/', 'href="'.static::URI, $content); + $content = str_replace('src=\'/', 'src=\''.static::URI, $content); + $content = str_replace('href=\'/', 'href=\''.static::URI, $content); $item['content'] = $content; $item['title'] = trim($title->innertext); - $item['uri'] = "http://www.allocine.fr" . $title->href; + $item['uri'] = static::URI . $title->href; $this->items[] = $item; } } } - public function getCacheDuration(){ - return 25200; // 7 hours - } } diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 629f459b..ef87499f 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -1,11 +1,12 @@ array( 'name'=>'Type', 'type'=>'list', @@ -25,7 +26,7 @@ class AnimeUltimeBridge extends BridgeAbstract { //Add type filter if provided $typeFilter = array_search( $this->getInput('type'), - $this->parameters[$this->queriedContext]['type']['values'] + self::PARAMETERS[$this->queriedContext]['type']['values'] ); //Build date and filters for making requests @@ -37,9 +38,9 @@ class AnimeUltimeBridge extends BridgeAbstract { foreach (array($thismonth, $lastmonth) as $requestFilter) { //Retrive page contents - $url = $this->uri.'history-0-1/'.$requestFilter; - $html = $this->getSimpleHTMLDOM($url) - or $this->returnServerError('Could not request Anime-Ultime: '.$url); + $url = self::URI.'history-0-1/'.$requestFilter; + $html = getSimpleHTMLDOM($url) + or returnServerError('Could not request Anime-Ultime: '.$url); //Relases are sorted by day : process each day individually foreach ($html->find('div.history', 0)->find('h3') as $daySection) { @@ -58,7 +59,7 @@ class AnimeUltimeBridge extends BridgeAbstract { //Retrieve metadata from table columns $item_link_element = $release->find('td', 0)->find('a', 0); - $item_uri = $this->uri.$item_link_element->href; + $item_uri = self::URI.$item_link_element->href; $item_name = html_entity_decode($item_link_element->plaintext); $item_episode = html_entity_decode(str_pad($release->find('td', 1)->plaintext, 2, '0', STR_PAD_LEFT)); $item_fansub = $release->find('td', 2)->plaintext; @@ -67,8 +68,8 @@ class AnimeUltimeBridge extends BridgeAbstract { if (!empty($item_uri)) { //Retrieve description from description page and convert relative image src info absolute image src - $html_item = $this->getContents($item_uri) - or $this->returnServerError('Could not request Anime-Ultime: '.$item_uri); + $html_item = getContents($item_uri) + or returnServerError('Could not request Anime-Ultime: '.$item_uri); $item_description = substr( $html_item, strpos($html_item, 'class="principal_contain" align="center">') @@ -79,7 +80,7 @@ class AnimeUltimeBridge extends BridgeAbstract { strpos($item_description, '
') ); $item_description = str_replace( - 'src="images', 'src="'.$this->uri.'images', + 'src="images', 'src="'.self::URI.'images', $item_description ); $item_description = str_replace("\r", '', $item_description); @@ -109,14 +110,10 @@ class AnimeUltimeBridge extends BridgeAbstract { public function getName() { $typeFilter = array_search( $this->getInput('type'), - $this->parameters[$this->queriedContext]['type']['values'] + self::PARAMETERS[$this->queriedContext]['type']['values'] ); return 'Latest '.$typeFilter.' - Anime-Ultime Bridge'; } - public function getCacheDuration() { - return 3600*3; // 3 hours - } - } diff --git a/bridges/ArstechnicaBridge.php b/bridges/ArstechnicaBridge.php deleted file mode 100644 index d2a62b2b..00000000 --- a/bridges/ArstechnicaBridge.php +++ /dev/null @@ -1,66 +0,0 @@ -', '', $string); - return $string; - } - - function ExtractContent($url) { - #echo $url; - $html2 = $this->getSimpleHTMLDOM($url); - - $text = $html2->find("section[id='article-guts']", 0); - /*foreach ($text->find('