Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the NasaPix #17

Closed
qwertygc opened this issue Aug 29, 2013 · 2 comments
Closed

Added the NasaPix #17

qwertygc opened this issue Aug 29, 2013 · 2 comments
Labels
New-Feature This is a new feature question Indicates that an issue or pull request needs more information

Comments

@qwertygc
Copy link
Contributor

http://apod.nasa.gov/apod/archivepix.html
Parce qu'il n'y a pas de flux existant et que c'est intéressant !

@mitsukarenai
Copy link
Member

Ce code HTML, CE CODE HTML D'UN AUTRE SIÈCLE !!!! 👎
J'abandonne. Faites-vous plaisir:

class NasaApodBridge extends BridgeAbstract{

    public function collectData(array $param) {

        $html = file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnError('Could not request NASA.', 404);

        $list = explode("<br>", $html->find('b', 0)->innertext);
        $i = 0;
        foreach($list as $line) {
            if($i < 5) {
                $item = new \Item();
            //$item->uri = 'http://apod.nasa.gov/apod/'.$line->find('a', 0)->getAttribute('href');
                $date = explode(' ', $line);
                $item->timestamp = strtotime($date[1].$date[2].$date[0]);
                $item->content = $line;
                $item->title = $line;
                $this->items[] = $item;
                $i++;
            }
        }
    }

    public function getName(){
        return 'NASA APOD';
    }

    public function getURI(){
        return 'http://apod.nasa.gov/apod/';
    }

    public function getCacheDuration(){
        return 3600*12; // 12 hours
    }
}

@Grummfy
Copy link
Contributor

Grummfy commented Jul 20, 2014

au cas où : http://apod.nasa.gov/apod.rss

mitsukarenai added a commit that referenced this issue Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New-Feature This is a new feature question Indicates that an issue or pull request needs more information
Projects
None yet
Development

No branches or pull requests

3 participants