mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-04 16:49:35 +00:00
[MinecraftBridge] Add Bridge
This commit is contained in:
parent
4d8a46d46e
commit
af878f6109
31
bridges/MinecraftBridge.php
Normal file
31
bridges/MinecraftBridge.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class MinecraftBridge extends BridgeAbstract
|
||||
{
|
||||
const NAME = 'Minecraft';
|
||||
const URI = 'https://www.minecraft.net';
|
||||
const DESCRIPTION = 'Catch up on the latest Minecraft articles';
|
||||
const MAINTAINER = 'tillcash';
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$json = getContents(
|
||||
'https://www.minecraft.net/content/minecraftnet/language-masters/en-us/_jcr_content.articles.page-1.json'
|
||||
);
|
||||
|
||||
$articles = json_decode($json);
|
||||
|
||||
if ($articles === null) {
|
||||
returnServerError('Failed to decode JSON content.');
|
||||
}
|
||||
|
||||
foreach ($articles->article_grid as $article) {
|
||||
$this->items[] = [
|
||||
'title' => $article->default_tile->title,
|
||||
'uid' => $article->article_url,
|
||||
'uri' => self::URI . $article->article_url,
|
||||
'content' => $article->default_tile->sub_header,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user