mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-02-01 16:03:41 +03:00
[New Bridge] WYMT news bridge (#3444)
* feat: add WYMT bridge * fix: phpcs error
This commit is contained in:
parent
1d3888f22a
commit
6eaa31b999
1 changed files with 27 additions and 0 deletions
27
bridges/WYMTNewsBridge.php
Normal file
27
bridges/WYMTNewsBridge.php
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue