forked from blallo/rss-bridge
[EliteDangerousGalnetBridge] code simplification
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
cee272ba6e
commit
d4d635a7d2
1 changed files with 4 additions and 3 deletions
|
@ -3,17 +3,18 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
public $maintainer = "corenting";
|
public $maintainer = "corenting";
|
||||||
public $name = "Elite: Dangerous Galnet";
|
public $name = "Elite: Dangerous Galnet";
|
||||||
public $uri = "https://community.elitedangerous.com/galnet";
|
public $uri = "https://community.elitedangerous.com/galnet/";
|
||||||
public $description = "Returns the latest page of news from Galnet";
|
public $description = "Returns the latest page of news from Galnet";
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = $this->getSimpleHTMLDOM('https://community.elitedangerous.com/galnet') or $this->returnServerError('Error while downloading the website content');
|
$html = $this->getSimpleHTMLDOM($this->uri)
|
||||||
|
or $this->returnServerError('Error while downloading the website content');
|
||||||
foreach($html->find('div.article') as $element) {
|
foreach($html->find('div.article') as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$uri = $element->find('h3 a', 0)->href;
|
$uri = $element->find('h3 a', 0)->href;
|
||||||
$uri = 'https://community.elitedangerous.com' . $uri;
|
$uri = $this->uri . substr($uri,strlen('/galnet/'));
|
||||||
$item['uri'] = $uri;
|
$item['uri'] = $uri;
|
||||||
|
|
||||||
$title = $element->find('h3 a', 0)->plaintext;
|
$title = $element->find('h3 a', 0)->plaintext;
|
||||||
|
|
Loading…
Reference in a new issue