1
0

Neu: HazeReverb News Bridge

This commit is contained in:
Akamaru
2025-12-03 21:37:23 +01:00
parent a8c412a752
commit 8c283e0bc4
2 changed files with 74 additions and 0 deletions

71
HazeReverbBridge.php Normal file
View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
class HazeReverbBridge extends BridgeAbstract
{
const MAINTAINER = 'Akamaru';
const NAME = 'HazeReverb News';
const URI = 'https://www.hazereverb.com/';
const CACHE_TIMEOUT = 3600; // 1 hour
const DESCRIPTION = 'Returns news and announcements from HazeReverb';
public function getIcon()
{
return 'https://www.google.com/s2/favicons?domain=hazereverb.com&sz=32';
}
public function collectData()
{
// Fetch the blog list
$listUrl = 'https://www.hazereverb.com/prod-api/system/blog/blogList?pageNum=1&pageSize=15';
$listJson = getContents($listUrl)
or returnServerError('Could not fetch blog list from HazeReverb API');
$listData = json_decode($listJson, true);
if (!isset($listData['rows']) || !is_array($listData['rows'])) {
returnServerError('Invalid response format from blog list API');
}
// Process each news item
foreach ($listData['rows'] as $newsItem) {
$newsId = $newsItem['id'] ?? null;
$title = $newsItem['title'] ?? null;
$createTime = $newsItem['createTime'] ?? null;
$createBy = $newsItem['createBy'] ?? null;
if (!$newsId || !$title) {
continue;
}
// Fetch the detailed content for this news item
$detailUrl = 'https://www.hazereverb.com/prod-api/system/blog/blogDetail?id=' . urlencode($newsId);
$detailJson = getContents($detailUrl);
if (!$detailJson) {
continue;
}
$detailData = json_decode($detailJson, true);
$content = $detailData['content'] ?? '';
// Build the feed item
$item = [];
$item['title'] = $title;
$item['uri'] = 'https://www.hazereverb.com/news?id=' . $newsId;
$item['content'] = $content;
$item['uid'] = $newsId;
if ($createTime) {
$item['timestamp'] = strtotime($createTime);
}
if ($createBy) {
$item['author'] = $createBy;
}
$this->items[] = $item;
}
}
}

View File

@@ -135,6 +135,9 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u
- **Parameter**:
- **Kategorie**: All, Games, Books, Software
### [HazeReverb News Bridge](https://bridge.ponywave.de/#bridge-HazeReverbBridge) (Von Akamaru)
- **Beschreibung**: Zeigt die neuesten Nachrichten und Ankündigungen von HazeReverb
### [Hytale News Bridge](https://bridge.ponywave.de/#bridge-HytaleNewsBridge) (Von Akamaru)
- **Beschreibung**: Zeigt die neuesten Nachrichten von Hytale
- **Parameter**: