Neu: Evercade Patch Notes Bridge
This commit is contained in:
66
EvercadePatchNotesBridge.php
Normal file
66
EvercadePatchNotesBridge.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
class EvercadePatchNotesBridge extends BridgeAbstract
|
||||
{
|
||||
const MAINTAINER = 'Akamaru';
|
||||
const NAME = 'Evercade Patch Notes';
|
||||
const URI = 'https://evercade.co.uk';
|
||||
const CACHE_TIMEOUT = 86400; // 24 hours
|
||||
const DESCRIPTION = 'Returns patch notes and version updates for Evercade consoles';
|
||||
|
||||
public function getIcon()
|
||||
{
|
||||
return 'https://www.google.com/s2/favicons?domain=evercade.co.uk&sz=32';
|
||||
}
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$html = getSimpleHTMLDOM(self::URI . '/support-vs/vs-patch-notes/')
|
||||
or returnServerError('Could not fetch Evercade patch notes page');
|
||||
|
||||
// Find all H3 version headings
|
||||
$versionHeadings = $html->find('h3');
|
||||
|
||||
foreach ($versionHeadings as $heading) {
|
||||
$headingText = $heading->plaintext;
|
||||
|
||||
// Extract version number using regex (e.g., "4.1.5" from "Version 4.1.5")
|
||||
if (preg_match('/Version\s+(\d+\.\d+(?:\.\d+)?)/i', $headingText, $matches)) {
|
||||
$versionNumber = $matches[1];
|
||||
|
||||
$item = [];
|
||||
$item['title'] = 'Evercade Update v' . $versionNumber;
|
||||
$item['uri'] = self::URI . '/support-vs/vs-patch-notes/';
|
||||
$item['uid'] = 'evercade-patch-' . $versionNumber;
|
||||
$item['author'] = 'Blaze';
|
||||
|
||||
// Collect content between this H3 and the next H3
|
||||
$content = $this->extractVersionContent($heading);
|
||||
$item['content'] = $content;
|
||||
|
||||
// No timestamp available on page - RSS-Bridge will use current time
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function extractVersionContent($heading): string
|
||||
{
|
||||
$content = '';
|
||||
$currentElement = $heading->next_sibling();
|
||||
|
||||
// Collect all content until next H3 or end
|
||||
while ($currentElement && $currentElement->tag !== 'h3') {
|
||||
// Get the outer HTML of the element to preserve formatting
|
||||
if (isset($currentElement->outertext)) {
|
||||
$content .= $currentElement->outertext;
|
||||
}
|
||||
$currentElement = $currentElement->next_sibling();
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,9 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u
|
||||
- Automatische Bereinigung von Autornamen (entfernt Suffixe wie ", Autor", ", Contributor" usw.)
|
||||
- Sortiert nach Datum (neueste zuerst)
|
||||
|
||||
### [Evercade Patch Notes Bridge](https://bridge.ponywave.de/#bridge-EvercadePatchNotesBridge) (Von Akamaru)
|
||||
- **Beschreibung**: Zeigt die Patch Notes und Versionsupdates für Evercade Konsolen
|
||||
|
||||
### [EverSD News Bridge](https://bridge.ponywave.de/#bridge-EverSDBridge) (Von Akamaru)
|
||||
- **Beschreibung**: EverSD News und Changelog.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user