From 88f5014a1696bfab8a78f47af21346373686b219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Mon, 29 Aug 2016 00:22:54 +0200 Subject: [PATCH] [GizmodoFRBridge] code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/GizmodoFRBridge.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bridges/GizmodoFRBridge.php b/bridges/GizmodoFRBridge.php index e79dcd4c..660da8a4 100644 --- a/bridges/GizmodoFRBridge.php +++ b/bridges/GizmodoFRBridge.php @@ -10,6 +10,9 @@ class GizmodoFRBridge extends BridgeAbstract{ function GizmodoFRExtractContent($url) { $articleHTMLContent = $this->getSimpleHTMLDOM($url); + if(!$articleHTMLContent){ + return 'Could not load '.$url; + } $text = $articleHTMLContent->find('div.entry-thumbnail', 0)->innertext; $text = $text.$articleHTMLContent->find('div.entry-excerpt', 0)->innertext; $text = $text.$articleHTMLContent->find('div.entry-content', 0)->innertext; @@ -21,7 +24,8 @@ class GizmodoFRBridge extends BridgeAbstract{ return $text; } - $rssFeed = $this->getSimpleHTMLDOM('http://www.gizmodo.fr/feed') or $this->returnServerError('Could not request http://www.gizmodo.fr/feed'); + $rssFeed = $this->getSimpleHTMLDOM($this->uri.'/feed') + or $this->returnServerError('Could not request '.$this->uri.'/feed'); $limit = 0; foreach($rssFeed->find('item') as $element) {