mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-12 11:34:09 +02:00
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
@@ -1,47 +1,46 @@
|
||||
<?php
|
||||
class Rue89Bridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'teromene';
|
||||
const NAME = 'Rue89';
|
||||
const URI = 'https://www.nouvelobs.com/rue89/';
|
||||
const DESCRIPTION = 'Returns the newest posts from Rue89';
|
||||
class Rue89Bridge extends BridgeAbstract
|
||||
{
|
||||
const MAINTAINER = 'teromene';
|
||||
const NAME = 'Rue89';
|
||||
const URI = 'https://www.nouvelobs.com/rue89/';
|
||||
const DESCRIPTION = 'Returns the newest posts from Rue89';
|
||||
|
||||
public function collectData() {
|
||||
public function collectData()
|
||||
{
|
||||
$jsonArticles = getContents('https://appdata.nouvelobs.com/rue89/feed.json');
|
||||
$articles = json_decode($jsonArticles)->items;
|
||||
foreach ($articles as $article) {
|
||||
$this->items[] = $this->getArticle($article);
|
||||
}
|
||||
}
|
||||
|
||||
$jsonArticles = getContents('https://appdata.nouvelobs.com/rue89/feed.json');
|
||||
$articles = json_decode($jsonArticles)->items;
|
||||
foreach($articles as $article) {
|
||||
$this->items[] = $this->getArticle($article);
|
||||
}
|
||||
private function getArticle($articleInfo)
|
||||
{
|
||||
$articleJson = getContents($articleInfo->json_url);
|
||||
$article = json_decode($articleJson);
|
||||
$item = [];
|
||||
$item['title'] = $article->title;
|
||||
$item['uri'] = $article->url;
|
||||
if ($article->content_premium !== null) {
|
||||
$item['content'] = $article->content_premium;
|
||||
} else {
|
||||
$item['content'] = $article->content;
|
||||
}
|
||||
$item['timestamp'] = $article->date_publi;
|
||||
$item['author'] = $article->author->show_name;
|
||||
|
||||
}
|
||||
$item['enclosures'] = [];
|
||||
foreach ($article->images as $image) {
|
||||
$item['enclosures'][] = $image->url;
|
||||
}
|
||||
|
||||
private function getArticle($articleInfo) {
|
||||
$item['categories'] = [];
|
||||
foreach ($article->categories as $category) {
|
||||
$item['categories'][] = $category->title;
|
||||
}
|
||||
|
||||
$articleJson = getContents($articleInfo->json_url);
|
||||
$article = json_decode($articleJson);
|
||||
$item = array();
|
||||
$item['title'] = $article->title;
|
||||
$item['uri'] = $article->url;
|
||||
if($article->content_premium !== null) {
|
||||
$item['content'] = $article->content_premium;
|
||||
} else {
|
||||
$item['content'] = $article->content;
|
||||
}
|
||||
$item['timestamp'] = $article->date_publi;
|
||||
$item['author'] = $article->author->show_name;
|
||||
|
||||
$item['enclosures'] = array();
|
||||
foreach($article->images as $image) {
|
||||
$item['enclosures'][] = $image->url;
|
||||
}
|
||||
|
||||
$item['categories'] = array();
|
||||
foreach($article->categories as $category) {
|
||||
$item['categories'][] = $category->title;
|
||||
}
|
||||
|
||||
return $item;
|
||||
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user