rss-bridge/bridges/QwantzBridge.php
Ryan Stafford ea0456ea08
[New Bridge] Qwantz bridge (#3531)
* [QwantzBridge] new bridge

* [QwantzBridge] title fix

* lint fixes
2023-07-15 05:58:57 +02:00

37 lines
1.1 KiB
PHP

<?php
class QwantzBridge extends FeedExpander
{
const NAME = 'Dinosaur Comics';
const URI = 'https://qwantz.com/';
const DESCRIPTION = 'Latest comic.';
protected function parseItem($feedItem)
{
$item = parent::parseItem($feedItem);
$item['author'] = 'Ryan North';
preg_match('/title="(.*?)"/', $item['content'], $matches);
$title = $matches[1];
$content = str_get_html(html_entity_decode($item['content']));
$comicURL = $content->find('img')[0]->{'src'};
$subject = $content->find('a')[1]->{'href'};
$subject = urldecode(substr($subject, strpos($subject, 'subject') + 8));
$p = (string)$content->find('P')[0];
$item['content'] = "{$subject}<figure><img src=\"{$comicURL}\"><figcaption><p>{$title}</p></figcaption></figure>{$p}";
return $item;
}
public function collectData()
{
$this->collectExpandableDatas(self::URI . 'rssfeed.php');
}
public function getIcon()
{
return self::URI . 'favicon.ico';
}
}