From 6990e850c86673edc416e7cf864ed1c557a21c42 Mon Sep 17 00:00:00 2001 From: "Y. Dongchen" Date: Sat, 28 Aug 2021 18:44:44 +1000 Subject: [PATCH] [ABCNewsBridge] New bridge --- bridges/ABCNewsBridge.php | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bridges/ABCNewsBridge.php diff --git a/bridges/ABCNewsBridge.php b/bridges/ABCNewsBridge.php new file mode 100644 index 00000000000..e82bed0339a --- /dev/null +++ b/bridges/ABCNewsBridge.php @@ -0,0 +1,45 @@ + array( + 'type' => 'list', + 'name' => 'Region', + 'title' => 'Choose state', + 'values' => array( + 'ACT' => 'act', + 'NSW' => 'nsw', + 'NT' => 'nt', + 'QLD' => 'qld', + 'SA' => 'sa', + 'TAS' => 'tas', + 'VIC' => 'vic', + 'WA' => 'wa' + ), + ) + ) + ); + + public function collectData() { + $url = 'https://www.abc.net.au/news/' . $this->getInput('topic'); + $html = getSimpleHTMLDOM($url)->find('.YAJzu._26IxR._2kxNB._3BZxh', 0); + $html = defaultLinkTo($html, $this->getURI()); + + foreach($html->find('._2H7Su') as $article) { + $item = array(); + + $title = $article->find('._3T9Id.fmhNa.nsZdE._2c2Zy._1tOey._3EOTW', 0); + $item['title'] = $title->plaintext; + $item['uri'] = $title->href; + $item['content'] = $article->find('.rMkro._1cBaI._3PhF6._10YQT._1yL-m', 0)->plaintext; + $item['timestamp'] = strtotime($article->find('time', 0)->datetime); + + $this->items[] = $item; + } + } +}