1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-01-16 13:50:01 +01:00

added new bridges (#3920)

* added new bridges

* lint

---------

Co-authored-by: Dag <me@dvikan.no>
This commit is contained in:
hleskien 2024-01-24 19:12:38 +01:00 committed by GitHub
parent 487c692e68
commit 1262cc982c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 298 additions and 0 deletions

View File

@ -0,0 +1,28 @@
<?php
class BundesverbandFuerFreieKammernBridge extends XPathAbstract
{
const NAME = 'Bundesverband für freie Kammern e.V.';
const URI = 'https://www.bffk.de/aktuelles/aktuelle-nachrichten.html';
const DESCRIPTION = 'Aktuelle Nachrichten';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://www.bffk.de/aktuelles/aktuelle-nachrichten.html';
//const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="icon"]/@href';
const XPATH_EXPRESSION_ITEM = '//ul[@class="article-list"]/li';
const XPATH_EXPRESSION_ITEM_TITLE = './/a/text()';
const XPATH_EXPRESSION_ITEM_CONTENT = './/a/text()';
const XPATH_EXPRESSION_ITEM_URI = './/a/@href';
//const XPATH_EXPRESSION_ITEM_AUTHOR = './/';
const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/span/i';
//const XPATH_EXPRESSION_ITEM_ENCLOSURES = './';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
protected function formatItemTimestamp($value)
{
$value = trim($value, '()');
$dti = DateTimeImmutable::createFromFormat('d.m.Y', $value);
$dti = $dti->setTime(0, 0, 0);
return $dti->getTimestamp();
}
}

View File

@ -0,0 +1,28 @@
<?php
class DeutscherAeroClubBridge extends XPathAbstract
{
const NAME = 'Deutscher Aero Club';
const URI = 'https://www.daec.de/news/';
const DESCRIPTION = 'News aus Luftsport und Dachverband';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://www.daec.de/news/';
const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="icon"][1]/@href';
const XPATH_EXPRESSION_ITEM = '//div[contains(@class, "news-list-view")]/div[contains(@class, "article")]';
const XPATH_EXPRESSION_ITEM_TITLE = './/span[@itemprop="headline"]';
const XPATH_EXPRESSION_ITEM_CONTENT = './/div[@itemprop="description"]/p';
const XPATH_EXPRESSION_ITEM_URI = './/div[@class="news-header"]//a/@href';
//const XPATH_EXPRESSION_ITEM_AUTHOR = './/';
const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime';
const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
protected function formatItemTimestamp($value)
{
$dti = DateTimeImmutable::createFromFormat('Y-m-d', $value);
$dti = $dti->setTime(0, 0, 0);
return $dti->getTimestamp();
}
}

View File

@ -0,0 +1,85 @@
<?php
class EDDHPiRepsBridge extends BridgeAbstract
{
const NAME = 'EDDH.de PIREPs';
const URI = 'https://eddh.de/info/pireps_08days.php';
const DESCRIPTION = 'Erfahrungen und Tipps von Piloten für Piloten: Die Einträge der letzten 8 Tage';
const MAINTAINER = 'hleskien';
//const PARAMETERS = [];
//const CACHE_TIMEOUT = 3600;
public function collectData()
{
$dom = getSimpleHTMLDOM(self::URI);
foreach ($dom->find('table table table td') as $itemnode) {
$texts = $this->extractTexts($itemnode->find('text, br'));
$timestamp = $itemnode->find('.su_dat', 0)->innertext();
$uri = $itemnode->find('.pir_hd a', 0)->href;
$this->items[] = [
'timestamp' => $this->formatItemTimestamp($timestamp),
'title' => $this->formatItemTitle($texts),
'uri' => $this->formatItemUri($uri),
'author' => $this->formatItemAuthor($texts),
'content' => $this->formatItemContent($texts)
];
}
}
public function getIcon()
{
return 'https://eddh.de/favicon.ico';
}
private function extractTexts($nodes)
{
$texts = [];
$i = 0;
foreach ($nodes as $node) {
$text = trim($node->outertext());
if ($node->tag == 'br') {
$texts[$i++] = "\n";
} elseif (($node->tag == 'text') && ($text != '')) {
$text = iconv('Windows-1252', 'UTF-8', $text);
$text = str_replace('&nbsp;', '', $text);
$texts[$i++] = $text;
}
}
return $texts;
}
protected function formatItemAuthor($texts)
{
$pos = array_search('Name:', $texts);
return $texts[$pos + 1];
}
protected function formatItemContent($texts)
{
$pos1 = array_search('Bemerkungen:', $texts);
$pos2 = array_search('Bewertung:', $texts);
$content = '';
for ($i = $pos1 + 1; $i < $pos2; $i++) {
$content .= $texts[$i];
}
return trim($content);
}
protected function formatItemTitle($texts)
{
$texts[5] = ltrim($texts[5], '(');
return implode(' ', [$texts[1], $texts[2], $texts[3], $texts[5]]);
}
protected function formatItemTimestamp($value)
{
$value = str_replace('Eintrag vom', '', $value);
$value = trim($value);
return strtotime($value);
}
protected function formatItemUri($value)
{
return 'https://eddh.de/info/' . $value;
}
}

View File

@ -0,0 +1,42 @@
<?php
class EDDHPresseschauBridge extends XPathAbstract
{
const NAME = 'EDDH.de Presseschau';
const URI = 'https://eddh.de/presse/presseschau.php';
const DESCRIPTION = 'Luftfahrt-Presseschau: Presse-Artikel aus der Luftfahrt';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://eddh.de/presse/presseschau.php';
//const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="icon"]/@href';
const XPATH_EXPRESSION_ITEM = '//table//table[.//p[@class="pressnews"]]//td';
const XPATH_EXPRESSION_ITEM_TITLE = './h4';
const XPATH_EXPRESSION_ITEM_CONTENT = './p[@class="pressnews"]';
const XPATH_EXPRESSION_ITEM_URI = './p[@class="pressnews"]/a/@href';
const XPATH_EXPRESSION_ITEM_AUTHOR = './p[@class="quelle"]';
const XPATH_EXPRESSION_ITEM_TIMESTAMP = './p[@class="quelle"]';
//const XPATH_EXPRESSION_ITEM_ENCLOSURES = './';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
public function getIcon()
{
return 'https://eddh.de/favicon.ico';
}
protected function formatItemAuthor($value)
{
$parts = explode('(', $value);
$author = trim($parts[0]);
return $author;
}
protected function formatItemTimestamp($value)
{
$parts = explode('(', $value);
$ws = ["\n", "\t", ' ', ')'];
$value = str_replace($ws, '', $parts[1]);
$dti = DateTimeImmutable::createFromFormat('d.m.Y', $value);
$dti = $dti->setTime(0, 0, 0);
return $dti->getTimestamp();
}
}

View File

@ -0,0 +1,22 @@
<?php
class FliegermagazinBridge extends XPathAbstract
{
const NAME = 'fliegermagazin';
const URI = 'https://www.fliegermagazin.de/news-fuer-piloten/';
const DESCRIPTION = 'News für Piloten';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://www.fliegermagazin.de/news-fuer-piloten/';
const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="shortcut icon"]/@href';
const XPATH_EXPRESSION_ITEM = '//article[@data-type="post"]';
const XPATH_EXPRESSION_ITEM_TITLE = './/h3/a/text()';
const XPATH_EXPRESSION_ITEM_CONTENT = './/h3/a/text()';
const XPATH_EXPRESSION_ITEM_URI = './/h3/a/@href';
const XPATH_EXPRESSION_ITEM_AUTHOR = './/p[@class="author-field"]';
// Timestamp kann nur durch Laden des Artikels herausgefunden werden
//const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/span/i';
const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
}

View File

@ -0,0 +1,26 @@
<?php
class LogicMastersBridge extends XPathAbstract
{
const NAME = 'Logic Masters Deutschland e.V.';
const URI = 'https://logic-masters.de/';
const DESCRIPTION = 'Aktuelles';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://logic-masters.de/';
//const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="SHORTCUT ICON"]/@href';
const XPATH_EXPRESSION_ITEM = '//div[@class="aktuelles_eintrag"]';
const XPATH_EXPRESSION_ITEM_TITLE = './div[@class="aktuelles_titel"]';
const XPATH_EXPRESSION_ITEM_CONTENT = './p';
//const XPATH_EXPRESSION_ITEM_URI = './a/@href';
//const XPATH_EXPRESSION_ITEM_AUTHOR = './/';
const XPATH_EXPRESSION_ITEM_TIMESTAMP = './div[@class="aktuelles_datum"]';
//const XPATH_EXPRESSION_ITEM_ENCLOSURES = './';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
protected function formatItemTimestamp($value)
{
$formatter = new IntlDateFormatter('de', IntlDateFormatter::LONG, IntlDateFormatter::NONE);
return $formatter->parse($value);
}
}

View File

@ -0,0 +1,41 @@
<?php
class LuftfahrtBundesAmtBridge extends XPathAbstract
{
const NAME = 'Luftfahrt-Bundesamt';
const URI = 'https://www.lba.de/DE/Home/Nachrichten/nachrichten_node.html';
const DESCRIPTION = 'alle Nachrichten: Liste aller Meldungen';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://www.lba.de/DE/Home/Nachrichten/nachrichten_node.html';
const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="shortcut icon"]/@href';
const XPATH_EXPRESSION_ITEM = '//table/tbody/tr';
const XPATH_EXPRESSION_ITEM_TITLE = './td[2]/a/text()';
const XPATH_EXPRESSION_ITEM_CONTENT = './td[2]/a/text()';
const XPATH_EXPRESSION_ITEM_URI = './td[2]/a/@href';
//const XPATH_EXPRESSION_ITEM_AUTHOR = './/';
const XPATH_EXPRESSION_ITEM_TIMESTAMP = './td[1]';
//const XPATH_EXPRESSION_ITEM_ENCLOSURES = './';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
protected function provideFeedIcon(\DOMXPath $xpath)
{
return parent::provideFeedIcon($xpath) . '?__blob=normal&v=3';
}
protected function formatItemTimestamp($value)
{
$value = trim($value);
$dti = DateTimeImmutable::createFromFormat('d.m.Y', $value);
$dti = $dti->setTime(0, 0, 0);
return $dti->getTimestamp();
}
// remove jsession part
protected function formatItemUri($value)
{
$parts = explode(';', $value);
return $parts[0];
}
}

View File

@ -0,0 +1,26 @@
<?php
class LuftsportSHBridge extends XPathAbstract
{
const NAME = 'Luftsportverband Schleswig-Holstein';
const URI = 'https://www.luftsport-sh.de/start.html';
const DESCRIPTION = 'Aktuelles vom Luftsportverband Schleswig-Holstein e.V.';
const MAINTAINER = 'hleskien';
const FEED_SOURCE_URL = 'https://www.luftsport-sh.de/start.html';
const XPATH_EXPRESSION_FEED_ICON = './/link[@rel="icon" and @sizes="16x16"]/@href';
const XPATH_EXPRESSION_ITEM = '//div[contains(@class, "mod_newslist")]/div';
const XPATH_EXPRESSION_ITEM_TITLE = './/*[@itemprop="name"]/a/text()';
const XPATH_EXPRESSION_ITEM_CONTENT = './/div[@itemprop="description"]/p/text()';
const XPATH_EXPRESSION_ITEM_URI = './h3/a/@href';
//const XPATH_EXPRESSION_ITEM_AUTHOR = './/';
const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime';
const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src';
//const XPATH_EXPRESSION_ITEM_CATEGORIES = './/';
protected function formatItemTimestamp($value)
{
$dti = DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM, $value);
return $dti->getTimestamp();
}
}