Пример #1
0
    };
    $get_content = function (&$art) {
        return $art;
    };
    $data->add_getter($get_arts, $get_content);
    return $data;
};
$datas['ultimahora'] = function () {
    $url = "http://www.ultimahora.com";
    $data = new RSSMetadata("ultimahora", "Ultima Hora Columnistas", $url);
    $get_arts = function () use($url) {
        $arts = array();
        $authors = array("Alfredo Boccia Paz", "Estela Ruiz Díaz", "Andrés Colmán Gutiérrez");
        foreach ($authors as $nombre) {
            $s = new Scrapper("{$url}/contenidos/resultado.html?text=" . str_replace(" ", "+", $nombre));
            foreach ($s->query('//div[@class="result-obj"]//h3/a') as $a) {
                $link = $a->attr('href');
                $title = $a->text();
                $arts[] = new Article($link, $title, $nombre);
            }
        }
        return $arts;
    };
    $get_content = function (&$art) {
        $s = new scrapper($art->link);
        $art->content .= $s->node('//section[contains(@class, "note-body")]')->html();
        $art->content .= $s->node('//div[contains(@class, "news-detail-obj")]')->html();
    };
    $data->add_getter($get_arts, $get_content);
    return $data;
};
Пример #2
0
 function ejes()
 {
     $ret = array();
     $s = new Scrapper(file_get_contents('http://portal.ejes.com/tapas-del-dia/'));
     $tapas = array('Nacion', 'Herald', 'Pagina', 'Tiempo', 'Pais', 'Clarin', 'Cronista', 'Ambito', 'BAE', 'Perfil', 'Economista', 'Estadista');
     foreach ($s->query('//ul[@class="tapitas"]//a') as $a) {
         foreach ($tapas as $tapa) {
             $diario = str_replace(" ", "", stripAccents($a->text()));
             if (strpos($diario, $tapa) !== false) {
                 $t = new Scrapper(file_get_contents($a->attr('href')));
                 foreach ($t->query('//img') as $img) {
                     if (!isset($ret[$diario])) {
                         $ret[$diario] = $img->attr('src');
                     }
                 }
             }
         }
     }
     return $ret;
 }
Пример #3
0
 function py_lanacion()
 {
     $y = date("Y", $this->t);
     $m = date("m", $this->t);
     $d = date("d", $this->t);
     $url = 'http://www.lanacion.com.py/category/tapa/';
     $s = new Scrapper($url, array('silence'));
     foreach ($s->query('//article//a') as $a) {
         if (strpos($a->attr('href'), "{$y}/{$m}/{$d}") !== false) {
             $s = new Scrapper($a->attr('href'), array('silence'));
             $img = $s->node('//div[@class="newsstand-blog-single-content"]/p//img')->attr('data-lazy-src');
             return '<img src="' . $img . '" style="width:100%;"><br>';
         }
     }
 }