forked from blallo/rss-bridge
[NasaApodBridge] code simplification
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
73dd97aa6b
commit
9c1c29ec74
1 changed files with 3 additions and 3 deletions
|
@ -3,12 +3,12 @@ class NasaApodBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public $maintainer = "corenting";
|
public $maintainer = "corenting";
|
||||||
public $name = "NASA APOD Bridge";
|
public $name = "NASA APOD Bridge";
|
||||||
public $uri = "http://apod.nasa.gov/apod/astropix.html";
|
public $uri = "http://apod.nasa.gov/apod/";
|
||||||
public $description = "Returns the 3 latest NASA APOD pictures and explanations";
|
public $description = "Returns the 3 latest NASA APOD pictures and explanations";
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM('http://apod.nasa.gov/apod/archivepix.html') or $this->returnServerError('Error while downloading the website content');
|
$html = $this->getSimpleHTMLDOM($this->uri.'archivepix.html') or $this->returnServerError('Error while downloading the website content');
|
||||||
$list = explode("<br>", $html->find('b', 0)->innertext);
|
$list = explode("<br>", $html->find('b', 0)->innertext);
|
||||||
|
|
||||||
for($i = 0; $i < 3;$i++)
|
for($i = 0; $i < 3;$i++)
|
||||||
|
@ -17,7 +17,7 @@ class NasaApodBridge extends BridgeAbstract{
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$uri_page = $html->find('a',$i + 3)->href;
|
$uri_page = $html->find('a',$i + 3)->href;
|
||||||
$uri = 'http://apod.nasa.gov/apod/'.$uri_page;
|
$uri = $this->uri.$uri_page;
|
||||||
$item['uri'] = $uri;
|
$item['uri'] = $uri;
|
||||||
|
|
||||||
$picture_html = $this->getSimpleHTMLDOM($uri);
|
$picture_html = $this->getSimpleHTMLDOM($uri);
|
||||||
|
|
Loading…
Reference in a new issue