From c38c7dd2a1defccc62008e0c3a26d259015749c5 Mon Sep 17 00:00:00 2001 From: Paul Vayssiere Date: Mon, 14 Jul 2014 12:12:01 -0500 Subject: [PATCH] add a Gizmodo.fr bridge to get the content And link to youtube videos --- bridges/GizmodoFRBridge.php | 57 +++++++++++++++++++++++++++++++++++++ bridges/NumeramaBridge.php | 4 +-- bridges/WordPressBridge.php | 2 +- 3 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 bridges/GizmodoFRBridge.php diff --git a/bridges/GizmodoFRBridge.php b/bridges/GizmodoFRBridge.php new file mode 100644 index 00000000..bb4bac1d --- /dev/null +++ b/bridges/GizmodoFRBridge.php @@ -0,0 +1,57 @@ +find('div.entry-thumbnail', 0)->innertext; + $text = $text.$articleHTMLContent->find('div.entry-excerpt', 0)->innertext; + $text = $text.$articleHTMLContent->find('div.entry-content', 0)->innertext; + foreach($articleHTMLContent->find('pagespeed_iframe') as $element) { + $text = $text.'

link to a iframe (could be a video): '.$element->src.'

'; + } + + $text = strip_tags($text, '

'); + return $text; + } + + $rssFeed = file_get_html('http://www.gizmodo.fr/feed') or $this->returnError('Could not request http://www.gizmodo.fr/feed', 404); + $limit = 0; + + foreach($rssFeed->find('item') as $element) { + if($limit < 15) { + $item = new \Item(); + $item->title = $element->find('title', 0)->innertext; + $item->uri = $element->find('guid', 0)->plaintext; + $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); + $item->content = GizmodoFRExtractContent($item->uri); + $this->items[] = $item; + $limit++; + } + } + + } + + public function getName(){ + return 'GizmodoFR'; + } + + public function getURI(){ + return 'http://www.gizmodo.fr/'; + } + + public function getCacheDuration(){ + return 1800; // 30min + } +} diff --git a/bridges/NumeramaBridge.php b/bridges/NumeramaBridge.php index 80070750..0c581971 100644 --- a/bridges/NumeramaBridge.php +++ b/bridges/NumeramaBridge.php @@ -1,6 +1,6 @@