From 6eaa31b9990c6de61c6ace40d9a4a757a11c8efa Mon Sep 17 00:00:00 2001 From: Matt Connell <matt@connell.tech> Date: Tue, 20 Jun 2023 09:13:41 -0400 Subject: [PATCH] [New Bridge] WYMT news bridge (#3444) * feat: add WYMT bridge * fix: phpcs error --- bridges/WYMTNewsBridge.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 bridges/WYMTNewsBridge.php diff --git a/bridges/WYMTNewsBridge.php b/bridges/WYMTNewsBridge.php new file mode 100644 index 00000000..c19d6e25 --- /dev/null +++ b/bridges/WYMTNewsBridge.php @@ -0,0 +1,27 @@ +<?php + +class WYMTNewsBridge extends BridgeAbstract +{ + const NAME = 'WYMT Mountain News'; + const URI = 'https://www.wymt.com/news/'; + const DESCRIPTION = 'Returns the recent articles published on WYMT Mountain News (Hazard KY)'; + const MAINTAINER = 'mattconnell'; + + public function collectData() + { + $html = getSimpleHTMLDOM(self::URI); + $html = defaultLinkTo($html, self::URI); + + $articles = $html->find('.card-body'); + + foreach ($articles as $article) { + $item = []; + $url = $article->find('.headline a', 0); + $item['uri'] = $url->href; + $item['title'] = trim($url->plaintext); + $item['author'] = $article->find('.author', 0)->plaintext; + $item['content'] = $article->find('.deck', 0)->plaintext; + $this->items[] = $item; + } + } +}