mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-05 00:59:35 +00:00
[EliteDangerousGalnetBridge] Fix missing news (#3071)
This commit is contained in:
parent
1ffd9ee61a
commit
4a21855e5c
@ -13,11 +13,13 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
|
|||||||
'name' => 'Language',
|
'name' => 'Language',
|
||||||
'type' => 'list',
|
'type' => 'list',
|
||||||
'values' => [
|
'values' => [
|
||||||
'English' => 'en',
|
'English' => 'en-US',
|
||||||
'French' => 'fr',
|
'French' => 'fr-FR',
|
||||||
'German' => 'de'
|
'German' => 'de-DE',
|
||||||
|
'Russian' => 'ru-RU',
|
||||||
|
'Spanish' => 'es-ES',
|
||||||
],
|
],
|
||||||
'defaultValue' => 'en'
|
'defaultValue' => 'en-US'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@ -25,26 +27,30 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
|
|||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$language = $this->getInput('language');
|
$language = $this->getInput('language');
|
||||||
$url = 'https://community.elitedangerous.com/';
|
$url = 'https://cms.zaonce.net/';
|
||||||
$url = $url . $language . '/galnet';
|
$url = $url . $language . '/jsonapi/node/galnet_article';
|
||||||
$html = getSimpleHTMLDOM($url);
|
$url = $url . '?&sort=-published_at&page[offset]=0&page[limit]=12';
|
||||||
|
|
||||||
foreach ($html->find('div.article') as $element) {
|
$html = getSimpleHTMLDOM($url);
|
||||||
|
$json = json_decode($html);
|
||||||
|
|
||||||
|
foreach ($json->data as $element) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|
||||||
$uri = $element->find('h3 a', 0)->href;
|
$uri = 'https://www.elitedangerous.com/news/galnet/';
|
||||||
$uri = 'https://community.elitedangerous.com/' . $language . $uri;
|
$uri = $uri . $element->attributes->field_slug;
|
||||||
$item['uri'] = $uri;
|
$item['uri'] = $uri;
|
||||||
|
|
||||||
$item['title'] = $element->find('h3 a', 0)->plaintext;
|
$item['title'] = $element->attributes->title;
|
||||||
|
|
||||||
$content = $element->find('p', -1)->innertext;
|
$picture = 'https://hosting.zaonce.net/elite-dangerous/galnet/';
|
||||||
$item['content'] = $content;
|
$picture = $picture . $element->attributes->field_galnet_image . '.png';
|
||||||
|
$picture = '<img src="' . $picture . '"/>';
|
||||||
|
|
||||||
$date = $element->find('p.small', 0)->innertext;
|
$content = $element->attributes->body->processed;
|
||||||
$article_year = substr($date, -4) - 1286; //Convert E:D date to actual date
|
$item['content'] = $picture . $content;
|
||||||
$date = substr($date, 0, -4) . $article_year;
|
|
||||||
$item['timestamp'] = strtotime($date);
|
$item['timestamp'] = strtotime($element->attributes->published_at);
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user