mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 01:55:21 +02:00
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
parent
66568e3a39
commit
4f75591060
398 changed files with 58607 additions and 56442 deletions
|
@ -1,40 +1,46 @@
|
|||
<?php
|
||||
class MsnMondeBridge extends FeedExpander {
|
||||
|
||||
const MAINTAINER = 'kranack';
|
||||
const NAME = 'MSN Actu Monde';
|
||||
const DESCRIPTION = 'Returns the 10 newest posts from MSN Actualités (full text)';
|
||||
const URI = 'https://www.msn.com/fr-fr/actualite';
|
||||
const FEED_URL = 'https://rss.msn.com/fr-fr';
|
||||
const JSON_URL = 'https://assets.msn.com/content/view/v2/Detail/fr-fr/';
|
||||
const LIMIT = 10;
|
||||
class MsnMondeBridge extends FeedExpander
|
||||
{
|
||||
const MAINTAINER = 'kranack';
|
||||
const NAME = 'MSN Actu Monde';
|
||||
const DESCRIPTION = 'Returns the 10 newest posts from MSN Actualités (full text)';
|
||||
const URI = 'https://www.msn.com/fr-fr/actualite';
|
||||
const FEED_URL = 'https://rss.msn.com/fr-fr';
|
||||
const JSON_URL = 'https://assets.msn.com/content/view/v2/Detail/fr-fr/';
|
||||
const LIMIT = 10;
|
||||
|
||||
public function getName() {
|
||||
return 'MSN Actualités';
|
||||
}
|
||||
public function getName()
|
||||
{
|
||||
return 'MSN Actualités';
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
return self::URI;
|
||||
}
|
||||
public function getURI()
|
||||
{
|
||||
return self::URI;
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$this->collectExpandableDatas(self::FEED_URL, self::LIMIT);
|
||||
}
|
||||
public function collectData()
|
||||
{
|
||||
$this->collectExpandableDatas(self::FEED_URL, self::LIMIT);
|
||||
}
|
||||
|
||||
protected function parseItem($newsItem) {
|
||||
$item = parent::parseItem($newsItem);
|
||||
if (!preg_match('#fr-fr/actualite.*/ar-(?<id>[\w]*)\?#', $item['uri'], $matches)) {
|
||||
return;
|
||||
}
|
||||
protected function parseItem($newsItem)
|
||||
{
|
||||
$item = parent::parseItem($newsItem);
|
||||
if (!preg_match('#fr-fr/actualite.*/ar-(?<id>[\w]*)\?#', $item['uri'], $matches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$json = json_decode(getContents(self::JSON_URL . $matches['id']), true);
|
||||
$item['content'] = $json['body'];
|
||||
if (!empty($json['authors']))
|
||||
$item['author'] = reset($json['authors'])['name'];
|
||||
$item['timestamp'] = $json['createdDateTime'];
|
||||
foreach($json['tags'] as $tag) {
|
||||
$item['categories'][] = $tag['label'];
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
$json = json_decode(getContents(self::JSON_URL . $matches['id']), true);
|
||||
$item['content'] = $json['body'];
|
||||
if (!empty($json['authors'])) {
|
||||
$item['author'] = reset($json['authors'])['name'];
|
||||
}
|
||||
$item['timestamp'] = $json['createdDateTime'];
|
||||
foreach ($json['tags'] as $tag) {
|
||||
$item['categories'][] = $tag['label'];
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue