From 1e998ab6dd2ecff0d8a4b79744ae85ab7ec5f0da Mon Sep 17 00:00:00 2001 From: ORelio Date: Sat, 23 Jan 2016 21:45:16 +0100 Subject: [PATCH] [CNET] Update HTML parsing to reflect changes HTML parsing wasn't working anymore due to changes on CNET's website. --- bridges/CNETBridge.php | 53 ++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index 28ada059..7b4e1b31 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -3,22 +3,22 @@ class CNETBridge extends BridgeAbstract { private $topicName = ''; - public function loadMetadatas() { + public function loadMetadatas() { - $this->maintainer = "ORelio"; - $this->name = "CNET News"; - $this->uri = "http://www.cnet.com/"; - $this->description = "Returns the newest articles.
You may specify a topic, else all topics are selected."; - $this->update = "2015-09-10"; + $this->maintainer = 'ORelio'; + $this->name = 'CNET News'; + $this->uri = 'http://www.cnet.com/'; + $this->description = 'Returns the newest articles.
You may specify a topic found in some section URLs, else all topics are selected.'; + $this->update = '2016-01-23'; - $this->parameters[] = - '[ - { - "name" : "Topic name", - "identifier" : "topic" - } - ]'; - } + $this->parameters[] = + '[ + { + "name" : "Topic name", + "identifier" : "topic" + } + ]'; + } public function collectData(array $param) { @@ -39,7 +39,8 @@ class CNETBridge extends BridgeAbstract { } function CleanArticle($article_html) { - $article_html = '

'.substr($article_html, strpos($article_html, '

') + 18); + $article_html = '

'.substr($article_html, strpos($article_html, '

') + 3); + $article_html = StripWithDelimiters($article_html, '', ''); $article_html = StripWithDelimiters($article_html, ''); $article_html = StripWithDelimiters($article_html, '

', '