Neu: Grabfeld Geschichte Bridge
This commit is contained in:
112
GrabfeldGeschichteBridge.php
Normal file
112
GrabfeldGeschichteBridge.php
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
class GrabfeldGeschichteBridge extends BridgeAbstract
|
||||||
|
{
|
||||||
|
const NAME = 'Das Grabfeld';
|
||||||
|
const URI = 'http://grabfeld-geschichte.de/';
|
||||||
|
const DESCRIPTION = 'Neue Ausgaben des Heimatsblatts "Das Grabfeld" als RSS-Feed.';
|
||||||
|
const MAINTAINER = 'Akamaru';
|
||||||
|
const CACHE_TIMEOUT = 86400; // 24 Stunden Cache
|
||||||
|
|
||||||
|
public function getIcon()
|
||||||
|
{
|
||||||
|
return 'https://www.google.com/s2/favicons?domain=grabfeld-geschichte.de&sz=32';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function collectData()
|
||||||
|
{
|
||||||
|
$url = self::URI;
|
||||||
|
$html = getSimpleHTMLDOM($url);
|
||||||
|
if (!$html) {
|
||||||
|
throw new \Exception('Konnte die Webseite nicht laden: ' . $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finde die TablePress-Tabelle mit den Ausgaben
|
||||||
|
$table = $html->find('table#tablepress-1', 0);
|
||||||
|
if (!$table) {
|
||||||
|
throw new \Exception('Konnte die Ausgaben-Tabelle nicht finden.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Durchlaufe alle Tabellenzeilen
|
||||||
|
foreach ($table->find('tbody tr') as $row) {
|
||||||
|
$columns = $row->find('td');
|
||||||
|
if (count($columns) < 3) {
|
||||||
|
continue; // Überspringe Zeilen ohne ausreichend Spalten
|
||||||
|
}
|
||||||
|
|
||||||
|
$column1 = $columns[0]->plaintext;
|
||||||
|
|
||||||
|
// Nur Zeilen verarbeiten, die "Ausgabe" enthalten
|
||||||
|
if (!preg_match('/Ausgabe\s+(\d+)/u', $column1, $ausgabeMatch)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ausgabeNummer = $ausgabeMatch[1];
|
||||||
|
|
||||||
|
// Extrahiere das Datum (z.B. "November 2025")
|
||||||
|
$datum = null;
|
||||||
|
if (preg_match('/(Januar|Februar|März|April|Mai|Juni|Juli|August|September|Oktober|November|Dezember)\s+(\d{4})/u', $column1, $datumMatch)) {
|
||||||
|
$monat = $datumMatch[1];
|
||||||
|
$jahr = $datumMatch[2];
|
||||||
|
$datum = $this->parseGermanDate($monat, $jahr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extrahiere Cover-Bild URL
|
||||||
|
$coverImg = $columns[1]->find('img', 0);
|
||||||
|
$coverUrl = $coverImg ? $coverImg->src : null;
|
||||||
|
|
||||||
|
// Baue absoluten URL falls nötig
|
||||||
|
if ($coverUrl && strpos($coverUrl, 'http') !== 0) {
|
||||||
|
$coverUrl = 'http://grabfeld-geschichte.de' . $coverUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erstelle RSS-Item
|
||||||
|
$item = [];
|
||||||
|
$item['title'] = 'Das Grabfeld Ausgabe ' . $ausgabeNummer;
|
||||||
|
$item['uri'] = self::URI;
|
||||||
|
$item['author'] = 'Verein für Heimatgeschichte im Grabfeld e.V.';
|
||||||
|
$item['timestamp'] = $datum ?: time();
|
||||||
|
|
||||||
|
// Cover als Content einbinden (mit Proxy für HTTP-Bilder)
|
||||||
|
if ($coverUrl) {
|
||||||
|
$proxiedUrl = 'https://akamaru.de/scripts/img.php?url=' . urlencode($coverUrl);
|
||||||
|
$item['content'] = '<img src="' . htmlspecialchars($proxiedUrl) . '" alt="Cover Ausgabe ' . $ausgabeNummer . '" />';
|
||||||
|
$item['enclosures'] = [$proxiedUrl];
|
||||||
|
} else {
|
||||||
|
$item['content'] = 'Ausgabe ' . $ausgabeNummer;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konvertiert deutsches Datum (Monat + Jahr) zu Unix-Timestamp
|
||||||
|
* Setzt den Tag immer auf den 1. des Monats
|
||||||
|
*/
|
||||||
|
private function parseGermanDate($monat, $jahr)
|
||||||
|
{
|
||||||
|
$monate = [
|
||||||
|
'Januar' => '01',
|
||||||
|
'Februar' => '02',
|
||||||
|
'März' => '03',
|
||||||
|
'April' => '04',
|
||||||
|
'Mai' => '05',
|
||||||
|
'Juni' => '06',
|
||||||
|
'Juli' => '07',
|
||||||
|
'August' => '08',
|
||||||
|
'September' => '09',
|
||||||
|
'Oktober' => '10',
|
||||||
|
'November' => '11',
|
||||||
|
'Dezember' => '12',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($monate[$monat])) {
|
||||||
|
$monatNummer = $monate[$monat];
|
||||||
|
return strtotime($jahr . '-' . $monatNummer . '-01');
|
||||||
|
}
|
||||||
|
|
||||||
|
return time(); // Fallback auf aktuelles Datum
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -138,6 +138,14 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u
|
|||||||
### [Girls' Frontline 2: Exilium News Bridge](https://bridge.ponywave.de/#bridge-GirlsFrontline2ExiliumNewsBridge) (Von Akamaru)
|
### [Girls' Frontline 2: Exilium News Bridge](https://bridge.ponywave.de/#bridge-GirlsFrontline2ExiliumNewsBridge) (Von Akamaru)
|
||||||
- **Beschreibung**: Zeigt die neuesten Nachrichten von Girls' Frontline 2: Exilium
|
- **Beschreibung**: Zeigt die neuesten Nachrichten von Girls' Frontline 2: Exilium
|
||||||
|
|
||||||
|
### [Grabfeld Geschichte Bridge](https://bridge.ponywave.de/#bridge-GrabfeldGeschichteBridge) (Von Akamaru)
|
||||||
|
- **Beschreibung**: Neue Ausgaben des Heimatsblatts "Das Grabfeld" als RSS-Feed
|
||||||
|
- **Hinweise**:
|
||||||
|
- Extrahiert Ausgaben aus der TablePress-Tabelle
|
||||||
|
- Cover-Bilder werden über HTTPS-Proxy geladen
|
||||||
|
- Datum wird auf den 1. des Monats gesetzt
|
||||||
|
- Autor ist auf "Verein für Heimatgeschichte im Grabfeld e.V." gesetzt
|
||||||
|
|
||||||
### [GronkhTV Bridge](https://bridge.ponywave.de/#bridge-GronkhTVBridge) (Von Akamaru)
|
### [GronkhTV Bridge](https://bridge.ponywave.de/#bridge-GronkhTVBridge) (Von Akamaru)
|
||||||
- **Beschreibung**: Neue Uploads auf GronkhTV
|
- **Beschreibung**: Neue Uploads auf GronkhTV
|
||||||
- **Parameter**:
|
- **Parameter**:
|
||||||
|
|||||||
Reference in New Issue
Block a user