$data->add_getter($get_arts, $get_content); return $data; }; $datas['levitsky'] = function () { $url = "http://larepublica.pe/persona/steven-levitsky"; $data = new RSSMetadata("levitsky", "Steven Levitsky en La República", $url); $get_arts = function () use($url) { $arts = array(); $s = new Scrapper($url); $a = $s->node('//a[@class="atm-title"]'); $arts[] = new Article($a->attr('href'), $a->text(), "Steven Levitsky"); return $arts; }; $get_content = function (&$art) { $s = new scrapper($art->link); $art->content = $s->node('//div[@id="note-body"]')->html(); }; $data->add_getter($get_arts, $get_content); return $data; }; $func = array(); $cmd = array(); $cmd['s'] = "Fetch articles."; $func['s'] = function ($val) use($datas) { foreach (explode(',', $val) as $s) { if (isset($datas[$s])) { $engine = new RSSEngine($datas[$s]()); $engine->fetch(); } } };