mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
[HytaleBridge] Add bridge (#2900)
This commit is contained in:
parent
ea45717a28
commit
f887ce8f63
1 changed files with 35 additions and 0 deletions
35
bridges/HytaleBridge.php
Normal file
35
bridges/HytaleBridge.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
class HytaleBridge extends BridgeAbstract
|
||||
{
|
||||
const NAME = 'Hytale Bridge';
|
||||
const URI = 'https://hytale.com/news';
|
||||
const DESCRIPTION = 'All blog posts from Hytale\'s news blog.';
|
||||
const MAINTAINER = 'llamasblade';
|
||||
|
||||
const _API_URL = 'https://hytale.com/api/blog/post/published';
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$blog_posts = json_decode(file_get_contents(self::_API_URL));
|
||||
|
||||
foreach ($blog_posts as $blog_post) {
|
||||
$item = [];
|
||||
|
||||
$splitted_timestamp = explode('-', $blog_post->publishedAt);
|
||||
$year = $splitted_timestamp[0];
|
||||
$month = $splitted_timestamp[1];
|
||||
$slug = $blog_post->slug;
|
||||
|
||||
$uri = 'https://hytale.com/news/' . $year . '/' . $month . '/' . $slug;
|
||||
|
||||
$item['uri'] = $uri;
|
||||
$item['title'] = $blog_post->title;
|
||||
$item['author'] = $blog_post->author;
|
||||
$item['timestamp'] = $blog_post->publishedAt;
|
||||
$item['content'] = $blog_post->bodyExcerpt;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue