[TheRedHandFiles]: New Bridge (#3229)

This blog had a feed, is updated irregularly, and someone disabled the
feed on the Wordpress config on purpose for some reason. :(
This commit is contained in:
somini 2023-01-28 06:39:59 +00:00 committed by GitHub
parent e44e458617
commit b21806a0b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,29 @@
<?php
class TheRedHandFilesBridge extends BridgeAbstract
{
const NAME = 'The Red Hand Files';
const URI = 'https://www.theredhandfiles.com';
const DESCRIPTION = 'The Red Hand Files, a Q&A blog by Nick Cave';
const MAINTAINER = 'somini';
/* The feed was available here: 'https://www.theredhandfiles.com/feed/'; */
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
foreach ($html->find('#main article.posts__article') as $element) {
$item = [];
$html_title = $element->find('h2', 0);
$html_subtitle = $element->find('h3', 0);
$html_image = $element->find('.posts__article-img', 0);
$item['title'] = $html_subtitle->plaintext;
$item['uri'] = $html_title->find('a', 0)->href;
$item['content'] = $html_image->innertext . $html_title->plaintext;
$this->items[] = $item;
}
}
}