Blue Archive: Nutze eigene API-URL für All News Kategorie
This commit is contained in:
@@ -28,30 +28,25 @@ class BlueArchiveNewsBridge extends BridgeAbstract {
|
||||
|
||||
public function collectData() {
|
||||
$category = $this->getInput('category');
|
||||
$boardIds = [];
|
||||
|
||||
if ($category === 'all') {
|
||||
$boardIds = ['3028', '3217', '3218'];
|
||||
} else {
|
||||
$boardIds = [$category];
|
||||
}
|
||||
$allThreads = [];
|
||||
foreach ($boardIds as $boardId) {
|
||||
$jsonUrl = "https://forum.nexon.com/api/v1/board/{$boardId}/threads?alias=bluearchive-en&pageNo=1&paginationType=PAGING&pageSize=10&blockSize=5&hideType=WEB";
|
||||
// Verwende eine einzige API-URL für alle Kategorien
|
||||
$jsonUrl = "https://forum.nexon.com/api/v1/community/314/threads?alias=bluearchive-en&paginationType=PAGING&pageSize=10&pageNo=1&blockSize=5&hideType=WEB";
|
||||
$json = getContents($jsonUrl);
|
||||
if (!$json) continue;
|
||||
if (!$json) return;
|
||||
$data = json_decode($json, true);
|
||||
if (!isset($data['threads'])) continue;
|
||||
foreach ($data['threads'] as $thread) {
|
||||
$thread['boardId'] = $boardId; // sicherstellen, dass boardId korrekt ist
|
||||
$allThreads[] = $thread;
|
||||
}
|
||||
if (!isset($data['threads'])) return;
|
||||
$threads = $data['threads'];
|
||||
} else {
|
||||
// Verwende die spezifische Board-URL für einzelne Kategorien
|
||||
$jsonUrl = "https://forum.nexon.com/api/v1/board/{$category}/threads?alias=bluearchive-en&pageNo=1&paginationType=PAGING&pageSize=10&blockSize=5&hideType=WEB";
|
||||
$json = getContents($jsonUrl);
|
||||
if (!$json) return;
|
||||
$data = json_decode($json, true);
|
||||
if (!isset($data['threads'])) return;
|
||||
$threads = $data['threads'];
|
||||
}
|
||||
// Nach createDate absteigend sortieren
|
||||
usort($allThreads, function($a, $b) {
|
||||
return $b['createDate'] <=> $a['createDate'];
|
||||
});
|
||||
// Maximal 10 insgesamt
|
||||
$threads = array_slice($allThreads, 0, 10);
|
||||
|
||||
foreach ($threads as $thread) {
|
||||
$item = array();
|
||||
$item['title'] = html_entity_decode($thread['title']);
|
||||
|
Reference in New Issue
Block a user