function iniciativaSubcom($organo) { $inic = ""; if (strpos($organo, "(") !== false) { $inic = quitarEspaciosSobra(substrHasta(substrDesde($organo, "("), ")")); } return $inic; }
function scrapSemana($sem, $year) { $url = "http://www.congreso.es/portal/page/portal/Congreso/GenericPopUp?_piref73_2138150_73_2138147_2138147.next_page=/wc/agendaCompleta&semana=" . $sem . "-" . $year; $html_content = scraperwiki::scrape($url); $html_content = traducirHTML($html_content); $agendaHTML = str_get_html($html_content); $num = 1; for ($i = 1; $i < 8; $i++) { $dia = array(); $agendaDia = $agendaHTML->find('div[id=agenda' . $i . ']', 0); $fechadia = sinTNS($agendaDia->find('div[class=prog_dia]', 0)->plaintext); $dia["fecha"] = fechaNumerica($fechadia); $dia["nombre"] = substrHasta($fechadia, " "); foreach ($agendaDia->find('div[class=parrilla]') as $element) { $evento = array(); $evento["dia"] = $dia["nombre"]; $evento["fecha"] = $dia["fecha"]; //$evento["id"]=$num."-".$sem."-".$year; $evento["id"] = $num; $evento["hora"] = getHora($element); $evento["url"] = getURL($element); $evento["lugar"] = getLugar($element); $evento["event"] = getEvento($element, $evento["lugar"]); $evento["info"] = getInfo($element, $evento["event"], $evento["lugar"]); print_r(". scrapeado evento " . $evento["id"]); print_r(". evento: " . $evento["event"]); scraperwiki::save_sqlite(array("id"), array("id" => $evento["id"], "dia" => $evento["dia"], "fecha" => $evento["fecha"], "hora" => $evento["hora"], "url" => $evento["url"], "lugar" => $evento["lugar"], "info" => $evento["info"], "event" => $evento["event"])); $num++; } } }