Code Monkey home page Code Monkey logo

Comments (2)

Grummfy avatar Grummfy commented on June 7, 2024 1

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

from rss-bridge.

mitsukarenai avatar mitsukarenai commented on June 7, 2024

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
    }
}

from rss-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.