Neu: HazeReverb News Bridge
This commit is contained in:
71
HazeReverbBridge.php
Normal file
71
HazeReverbBridge.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -135,6 +135,9 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u
|
|||||||
- **Parameter**:
|
- **Parameter**:
|
||||||
- **Kategorie**: All, Games, Books, Software
|
- **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)
|
### [Hytale News Bridge](https://bridge.ponywave.de/#bridge-HytaleNewsBridge) (Von Akamaru)
|
||||||
- **Beschreibung**: Zeigt die neuesten Nachrichten von Hytale
|
- **Beschreibung**: Zeigt die neuesten Nachrichten von Hytale
|
||||||
- **Parameter**:
|
- **Parameter**:
|
||||||
|
|||||||
Reference in New Issue
Block a user