function extract_label_koef($html) { $html = kill_tag_bound($html, 'div|tr'); $label = delete_all(copy_be($html, '<td', '</td>', 'label'), '<', '>'); $koef = delete_all(copy_be($html, '<td', '</td>', '\'odd\''), '<', '>'); return array($label, $koef); }
function extract_bet($Html) { $Html = kill_tag_bound($Html, 'b|a|font|img'); $Html = str_ireplace('\'style', '\' style', $Html); $Html = str_ireplace('nowrap', '', $Html); $Html = kill_space($Html); $Html = numbering_tag($Html, 'table'); $Html = extract_numbered_tags($Html, 'table', "\r\n", 'width=\'70%\''); $Html = kill_property($Html, "onmousemove|onmouseout|valign|align|class|style|height|width|cellpadding|cellspacing|border"); $Html = kill_property($Html, 'TagNo'); // раскрываем таблицы в дате и заголовках for ($i = 2; $i < 20; $i++) { $Html = str_ireplace(" colspan='{$i}'", " colspan={$i}", $Html); $Html = str_ireplace(" colspan=\"{$i}\"", " colspan={$i}", $Html); } $Html = str_ireplace('<th colspan=6><table><tr>', '', $Html); $Html = str_ireplace('</tr></table></th>', '', $Html); $Html = str_ireplace('<td colspan=6><table><tr>', '', $Html); $Html = str_ireplace('<td colspan=15><table><tr>', '', $Html); $Html = str_ireplace('</tr></table></td>', '', $Html); // убираем комментарии $Html = replace_all_contain($Html, '<tr>', '</tr>', '', 'Комментарий к событию:|Сеты'); $Html = replace_all_contain($Html, '<span>', '</span>', '', 'Вернуться'); $Html = str_ireplace('>--<', '><', $Html); // Ставим точку в виде спорта $Html = str_ireplace('><span>', '>', $Html); $Html = str_ireplace('<span>', '. ', $Html); $Html = str_ireplace('</span>', '', $Html); return $Html; }
function extract_bet($Html) { $Html = copy_be($Html, '<form ', '</form>', 'betform'); $Html = kill_tag($Html, 'script|div'); $Html = kill_space($Html); $Html = kill_tag_bound($Html, 'b|span|br|i|a|input|font|img'); $Html = delete_all($Html, '<tr', '</tr>', 'line3'); $Html = kill_property_value_exclude($Html, 'class', 'line_table'); $Html = kill_property($Html, 'width|height|valign|align|bgcolor|style|border|cellspacing|cellpadding'); // Убираем "левые" данные $Html = replace_all_contain($Html, '<tr', '</tr>', '', 'Хозяева|' . 'Гости|' . 'Индив.тотал:|' . '-я четверть|' . '-я партия|' . ' тайм|' . '-й сет'); return $Html; }
function extract_bet($Html) { $Html = extract_tags($Html, '<table cellSpacing=2 cellPadding=1', '</table>', "\r\n"); $Html = kill_space($Html); $Html = kill_tag_bound($Html, 'b|a|br|font|img'); $Html = str_ireplace(' nowrap', '', $Html); $Html = kill_property($Html, 'onmouseover|onclick|align|id|style|width|cellspacing'); // Убираем строки без ставок $Html = delete_all($Html, '<tr>', '</tr>', 'class="t_comment"'); $Html = delete_all($Html, '<tr>', '</tr>', 'class="t_comment1"'); $Html = str_ireplace(' class=date', ' @lass=date', $Html); $Html = kill_property($Html, 'class'); $Html = str_ireplace(' @lass=date', ' class=date', $Html); return $Html; }
function extract_bet($Html) { $Html = extract_tags($Html, '<table ', '</table>', '', 'Дома'); $Html = kill_space($Html); $Html = str_ireplace('=>', '|', $Html); $Html = kill_comment($Html); $Html = kill_tag($Html, 'script'); $Html = kill_tag_bound($Html, 'input|b|a|img|strong'); $Html = str_ireplace('<br>', '|', $Html); $Html = str_ireplace('>-<', '><', $Html); $Html = str_ireplace(' bgcolor="#66FFFF"', ' league="#66FFFF"', $Html); $Html = kill_property($Html, 'bgcolor|align|valign|width|border|class'); $Html = replace_all_contain($Html, '<tr', '</tr>', '', 'угл |' . 'ж.к '); return $Html; }
function extract_bet($Html) { // Разбираемся с концами строк $Html = str_ireplace("\n", '<br>', $Html); $Html = str_ireplace("\r", '<br>', $Html); $Html = copy_be($Html, '<form name=f1>', '</form>'); $Html = str_ireplace(' ', ' ', $Html); $Html = kill_tag_bound($Html, 'input|itemevent|a|b'); $Html = str_ireplace(' noshade', '', $Html); $Html = kill_property($Html, 'time|color'); $Html = replace_all($Html, '<sup>', '</sup>', ' '); $Html = kill_tag($Html, 'big'); $Html = str_ireplace('<endpreview/>', '', $Html); $Html = str_ireplace('<hr><br>', '<hr>', $Html); $Html = str_ireplace('<br>Оглавление<', '<', $Html); $Html = str_ireplace('<br>Оглавление<', '<', $Html); $Html = replace_all($Html, '<u>', '</form>', '</form>'); $Html = kill_tag_bound($Html, 'u|form'); $Html = delete_all($Html, '<span ', '</span>', 'maxcap'); return $Html; }
function extract_bet($Html) { $Html = copy_be($Html, '<form name=f1', '</form>', 'Дома'); $Html = kill_space($Html); $Html = kill_tag($Html, 'script'); $Html = kill_tag_bound($Html, 'b|a|tbody|small|colgroup'); // <!-- Выносим Экспресы и информацию о предыдущих встречах --> $Html = str_ireplace('<span class=tr>1</span>', '', $Html); $Html = delete_all($Html, '<tr>', '</tr>', '<span class=tr>'); $Html = delete_all($Html, '<span class=n>', '</span>'); // <!-- Убираем строки с кнопками --> $Html = delete_all($Html, '<table ', '</table>', '<input '); // <!-- Заменяем IMG с информацией на igif для последующего удаления --> $Html = replace_all($Html, '<img ', '>', "igif"); // <!-- Убираем левые коэффициенты в скобках --> $Html = replace_all($Html, '>(', ')', '>'); // <!-- Убираем оглавление --> $Html = delete_all($Html, "<div ", "</div", "Оглавление"); $Html = kill_property($Html, 'width|border'); $Html = replace_all_contain($Html, '<tr', '</tr>', '', '>Хозяева|' . '>Гости|' . '>Фолы|' . '>ж/к|' . '>угл.'); return $Html; }
function extract_bet($Html) { $Html = delete_all($Html, "(at ", ")"); $Html = delete_all($Html, "(score: ", ")"); $Html = str_ireplace('<wbr/>', '', $Html); $Html = str_replace("-.--", " ", $Html); $Html = kill_tag($Html, "h1|script"); $Html = kill_space($Html); $Html = kill_comment($Html); $Html = numbering_tag($Html, 'div'); $Html = extract_numbered_tags($Html, 'div', "", "bet-list"); $Html = extract_numbered_tags($Html, 'div', "", "dsBodyContent"); $Html = kill_property($Html, 'TagNo'); $Html = kill_property($Html, "onmouseover|onmouseout|onclick|bgcolor|border|cellpadding|leaguename|id|width|cellspacing|regionname"); $Html = kill_property_value($Html, "colspan", "1"); $Html = kill_tag_bound($Html, "form|input|a|nobr|img|tbody|span"); $Html = delete_all($Html, ' class="unselected ', '"'); $Html = delete_all($Html, ' class=\'unselected ', '\''); $Html = replace_all_contain($Html, '<div', '</div>', '', 'isFavourite|' . 'isNoFavourite'); $Html = replace_all_contain($Html, '<tr', '</tr>', '', 'sizer|' . 'bottomline'); $Html = kill_property_value_exclude($Html, "class", "controlHeaderNoShadow|topbar|normal|def|alt|ControlContent"); $Html = str_ireplace('<td></td>', '<td/>', $Html); $Html = kill_unclassed_tag($Html, 'div'); $Html = kill_apostrof($Html, 'colspan'); // !-- Приводим Totalы к нормальному виду --> $Html = replace_all($Html, "<h5>Сумма набранных очков ", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Тотал ", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Сколько будет забито голов?", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Сколько голов будет забито?", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Сколько геймов будет сыграно в матче?", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Кто выиграет больше геймов в матче? (гандикап игрока)", '</h5>', '<h5>Fora</h5>'); $Html = replace_all($Html, "<h5>Двойной шанс", '</h5>', '<h5>1X_12_X2</h5>'); $Html = str_ireplace('<tr class="alt"', "\r\n" . '<tr class="alt"', $Html); $Html = str_ireplace('<tr class="def"', "\r\n" . '<tr class="alt"', $Html); $Tags = explode("\r\n", $Html); foreach ($Tags as $tag) { if (copy_be($tag, '>', '<', ' - ', ' - ', ':')) { $Html = str_ireplace("\r\n" . $tag, str_ireplace('="alt"', '="evn"', $tag), $Html); } } $Tags = explode("\r\n", $Html); foreach ($Tags as $tag) { if (strpos($tag, '"alt"')) { $newtag = numbering_tag($tag, 'tr'); $trAlt = extract_numbered_tags($newtag, 'tr', '', 'alt'); $h5 = delete_all($trAlt, '<', '>'); if (strpos($h5, ' ')) { $newtag = str_replace($trAlt, '', $newtag); $Normals = explode("\r\n", extract_numbered_tags($newtag, 'tr', "\r\n", 'normal')); foreach ($Normals as $normal) { $newtag = str_replace($normal, '', $newtag); } $newtag = kill_property($newtag, 'TagNo'); $Html = str_replace($tag, $newtag, $Html); } } } $Html = str_ireplace("\r\n", '', $Html); $Html = str_ireplace('<tr class="evn"', "\r\n" . '<tr class="evn"', $Html); $Tags = explode("\r\n", $Html); foreach ($Tags as $tag) { if (strpos($tag, '"evn"')) { $newtag = numbering_tag($tag, 'tr'); $trEvn = extract_numbered_tags($newtag, 'tr', '', 'evn'); if (strpos($newtag, '="normal"') == 0) { $newtag = str_replace($trEvn, '', $newtag); } $newtag = kill_property($newtag, 'TagNo'); $Html = str_replace($tag, $newtag, $Html); } } $Html = str_ireplace("\r\n", '', $Html); return $Html; }
function extract_bet($Html) { $Html = kill_space($Html); $Html = numbering_tag($Html, 'table'); $Html = extract_numbered_tags($Html, 'table', '', 'content'); $Tags = explode("\r\n", extract_tags($Html, '<table', 'height="22"', "\r\n")); foreach ($Tags as $tag) { $TagNo = extract_tagno($tag, 'table'); $Table = extract_numbered_tag($Html, 'table', $TagNo); if (stripos($Table, 'поб.1') > 0) { $Result .= $Table; } } $Html = $Result; $Html = str_ireplace('>-<', '><', $Html); $Html = kill_comment($Html); $Html = kill_tag($Html, 'script'); $Html = kill_tag_bound($Html, 'a|b|img|strong'); $Html = kill_property($Html, 'tagno|bgcolor|align|valign|width|cellspacing|border|cellpadding'); $Html = replace_all_contain($Html, '<tr', '</tr>', '', ' тайм)|' . ' тайм:|' . ' четверть:|' . '-й сет:|' . 'Дополнительные тоталы:|' . 'colspan="17"|' . 'Первый матч|' . 'Второй матч|' . 'Хозяева|' . 'Счет серии'); return $Html; }
private function extract_main_bets(&$tournir_node, $html, $sport_sign, $tournir_id) { $event_id = extract_property_values(copy_be($html, '<ul', '>', 'rel'), 'rel', ''); $html = kill_tag_bound($html, 'u'); $cells = extract_all_tags($html, '<li', '</li>'); $i = 0; foreach ($cells as $cell) { $cells[$i++] = delete_all($cell, '<', '>', 'li'); } list($day_no, $month_no, $year_no, $hour, $minute) = $this->decode_datetime(str_ireplace('<br>', ' ', $cells[0])); list($gamer1_name, $gamer2_name) = explode('<br/>', $cells[2]); $event_node = $this->event_create($tournir_node, $event_id, mktime($hour, $minute, 0, $month_no, $day_no, $year_no), $gamer1_name, $gamer2_name); if ($cells[3] != '') { $this->addBet($event_node, $this->header[3] . ';Koef=' . $cells[3]); } if ($cells[4] != '') { $this->addBet($event_node, $this->header[4] . ';Koef=' . $cells[4]); } if ($cells[5] != '') { $this->addBet($event_node, $this->header[5] . ';Koef=' . $cells[5]); } if ($cells[6] != '') { $this->addBet($event_node, $this->header[6] . ';Koef=' . $cells[6]); } if ($cells[7] != '') { $this->addBet($event_node, $this->header[7] . ';Koef=' . $cells[7]); } if ($cells[8] != '') { $this->addBet($event_node, $this->header[8] . ';Koef=' . $cells[8]); } if ($cells[9] != '') { preg_match('/\\(([\\+\\-]*?)(.+?)\\)<br\\/>(.+?)/iU', $cells[9], $matches); if ($matches[1] == '' and $matches[2] != '0') { $matches[1] = '+'; } $this->addBet($event_node, $this->header[9] . ';Value=' . $matches[1] . $matches[2] . ';Koef=' . $matches[3]); } if ($cells[10] != '') { preg_match('/\\(([\\+\\-]*?)(.+?)\\)<br\\/>(.+?)/iU', $cells[10], $matches); if ($matches[1] == '' and $matches[2] != '0') { $matches[1] = '+'; } $this->addBet($event_node, $this->header[10] . ';Value=' . $matches[1] . $matches[2] . ';Koef=' . $matches[3]); } if ($cells[12] != '') { $value = $cells[11]; if (!strpos($value, '.')) { $value = $value - 0.5; } $this->addBet($event_node, $this->header[12] . ';Value=' . $value . ';Koef=' . $cells[12]); } if ($cells[13] != '') { $value = $cells[11]; if (!strpos($value, '.')) { $value = $value + 0.5; } $this->addBet($event_node, $this->header[13] . ';Value=' . $value . ';Koef=' . $cells[13]); } }
private function extract_main_bets_soccer(&$tournir_node, $html, $sport_sign, $tournir_id) { $html = str_ireplace('<tr', '<tr', $html); $html = str_ireplace('</tr', '</tr', $html); $html = copy_be($html, '<tr ', '</tr>', 'class=', 'tc'); $event_id = copy_between($html, 'shdop(\'', '\''); $html = kill_tag_bound($html, 'b|a'); $cells = extract_all_tags($html, '<td>', '</td>'); $i = 0; foreach ($cells as $cell) { $cells[$i++] = delete_all($cell, '<', '>'); } list($hour, $minute) = $this->decode_time($cells[0]); $gamer1_name = $cells[1]; $gamer2_name = $cells[4]; $event_node = $this->event_create($tournir_node, $event_id, mktime($hour, $minute, 0, $this->month_no, $this->day_no, $this->year_no), $gamer1_name, $gamer2_name); if ($cells[3] != '') { $this->addBet($event_node, $this->header[3] . ';Value=' . $cells[2] . ';Koef=' . $cells[3]); } if ($cells[6] != '') { $this->addBet($event_node, $this->header[6] . ';Value=' . $cells[5] . ';Koef=' . $cells[6]); } if ($cells[7] != '') { $this->addBet($event_node, $this->header[7] . ';Koef=' . $cells[7]); } if ($cells[8] != '') { $this->addBet($event_node, $this->header[8] . ';Koef=' . $cells[8]); } if ($cells[9] != '') { $this->addBet($event_node, $this->header[9] . ';Koef=' . $cells[9]); } if ($cells[10] != '') { $this->addBet($event_node, $this->header[10] . ';Koef=' . $cells[10]); } if ($cells[11] != '') { $this->addBet($event_node, $this->header[11] . ';Koef=' . $cells[11]); } if ($cells[12] != '') { $this->addBet($event_node, $this->header[12] . ';Koef=' . $cells[12]); } if ($cells[14] != '') { $this->addBet($event_node, $this->header[14] . ';Value=' . $cells[13] . ';Koef=' . $cells[14]); } if ($cells[15] != '') { $this->addBet($event_node, $this->header[15] . ';Value=' . $cells[13] . ';Koef=' . $cells[15]); } }
private function extract_main_bets(&$tournir_node, $html, $sport_sign, $tournir_id) { $html = kill_property($html, 'TagNo'); $html = numbering_tag($html, 'tr'); $events = extract_all_numbered_tags($html, 'tr', 'event-header'); foreach ($events as $event) { // получаем $event_info = take_be($event, '<table', '</table>'); file_put_contents("Event.html", $event_info); preg_match_all('/<div class="(.*)?member-name(.*)?">(.*)?<\\/div>/imsU', $event_info, $matches); $gamer1_name = $matches[3][0]; $gamer2_name = $matches[3][1]; $datetime_str = delete_all(copy_be($event_info, '<td', '</td>', '"date"'), '<', '>'); list($day_no, $month_no, $year_no, $hour, $minute) = $this->decode_datetime($datetime_str); $extrabet = copy_be($event_info, '<a', '</a>', 'treeid'); $event_id = extract_property_values($extrabet, 'treeid', ''); $extrabet = delete_all($extrabet, '<', '>'); $event_node = $this->event_create($tournir_node, $event_id, mktime($hour, $minute, 0, $month_no, $day_no, $year_no), $gamer1_name, $gamer2_name); $cells = extract_all_tags(replace_all($event, '<td', '>', '<td>'), '<td>', '</td>'); $i = 0; foreach ($cells as $cell) { $cell = trim(copy_between($cell, '<td>', '</td>')); if ($cell) { $cell = kill_tag_bound($cell, 'a'); unset($bettype); $bettype_str = $this->header[$i]; foreach (explode(';', $bettype_str) as $bet_pair) { list($key, $value) = explode('=', $bet_pair); $bettype[$key] = $value; } if ($bettype['Kind'] == 'Total') { preg_match('/\\((.+?)\\)<br\\/>(.+?)/iU', $cell, $matches); if ($matches[2]) { $matches[2] = delete_all($matches[2], '<', '>'); $this->addBet($event_node, $bettype_str . ';Value=' . $matches[1] . ';Koef=' . $matches[2]); } } elseif ($bettype['Kind'] == 'Fora') { preg_match('/\\(([\\+\\-]*?)(.+?)\\)<br\\/>(.+?)/iU', $cell, $matches); if ($matches[3]) { $matches[3] = delete_all($matches[3], '<', '>'); $this->addBet($event_node, $bettype_str . ';Value=' . $matches[1] . $matches[2] . ';Koef=' . $matches[3]); } } else { $cell = delete_all($cell, '<', '>'); $this->addBet($event_node, $bettype_str . ';Koef=' . $cell); } } $i++; } //if ($extrabet > 0) $this->extract_extra_bets($event_node, $tournir_id, $event_id); } }
function extract_bet($Html) { $Html = str_ireplace(' nowrap', ' ', $Html); $Html = kill_space($Html); $Html = kill_comment($Html); $Html = extract_tags($Html, '<table ', '</table>', "\r\n", 'class="OT"'); $Html = kill_tag($Html, "script"); $Html = kill_tag_bound($Html, "form|input|a|nobr|img|tbody|div"); $Html = kill_property($Html, "onmouseover|onmouseout|onclick|bgcolor|border|cellpadding|cellspacing|width|id|class"); return $Html; }
function extract_main_bets(&$tournir_node, $html, $sport_sign, $tournir_id) { $subjects_file = "phrases/olymp/subjects.txt"; $subjects = file_get_hash($subjects_file); $event_id = extract_property_values(copy_be($html, '<ul', '>', 'rel'), 'rel', ''); $html = kill_tag_bound($html, 'u'); $cells = extract_all_tags($html, '<li', '</li>'); $i = 0; foreach ($cells as $cell) { $cells[$i++] = delete_all($cell, '<', '>', 'li'); } list($day_no, $month_no, $year_no, $hour, $minute) = decode_datetime(str_ireplace('<br>', ' ', $cells[0])); list($gamer1_name, $gamer2_name) = explode('<br/>', $cells[2]); $event_node = event_create($tournir_node, $event_id, mktime($hour, $minute, 0, $month_no, $day_no, $year_no), $gamer1_name, $gamer2_name); if ($cells[3] != '') { add_bet($event_node, 'Period=Match;Gamer=1;Modifier=Win;Koef=' . $cells[3]); } if ($cells[4] != '') { add_bet($event_node, 'Period=Match;Modifier=Draw;Koef=' . $cells[4]); } if ($cells[5] != '') { add_bet($event_node, 'Period=Match;Gamer=2;Modifier=Win;Koef=' . $cells[5]); } if ($cells[6] != '') { add_bet($event_node, 'Period=Match;Kind=DoubleChance;Modifier=NoLose;Gamer=1;Koef=' . $cells[6]); } if ($cells[7] != '') { add_bet($event_node, 'Period=Match;Kind=DoubleChance;Modifier=NoDraw;Koef=' . $cells[7]); } if ($cells[8] != '') { add_bet($event_node, 'Period=Match;Kind=DoubleChance;Modifier=NoLose;Gamer=2;Koef=' . $cells[8]); } if ($cells[9] != '') { preg_match('/\\(([\\+\\-]*?)(.+?)\\)<br\\/>(.+?)/iU', $cells[9], $matches); if ($matches[1] == '' and $matches[2] != '0') { $matches[1] = '+'; } add_bet($event_node, 'Period=Match;Kind=Fora;Value=' . $matches[1] . $matches[2] . ';Modifier=Win;Gamer=1;Koef=' . $matches[3]); } if ($cells[10] != '') { preg_match('/\\(([\\+\\-]*?)(.+?)\\)<br\\/>(.+?)/iU', $cells[10], $matches); if ($matches[1] == '' and $matches[2] != '0') { $matches[1] = '+'; } add_bet($event_node, 'Period=Match;Kind=Fora;Value=' . $matches[1] . $matches[2] . ';Modifier=Win;Gamer=2;Koef=' . $matches[3]); } if ($cells[12] != '') { $value = $cells[11]; if (!strpos($value, '.')) { $value = $value + 0.5; } add_bet($event_node, 'Period=Match;' . $subjects[$sport_sign] . ';Kind=Total;Value=' . $value . ';Modifier=Under;Koef=' . $cells[12]); } if ($cells[13] != '') { $value = $cells[11]; if (!strpos($value, '.')) { $value = $value - 0.5; } add_bet($event_node, 'Period=Match;' . $subjects[$sport_sign] . ';Kind=Total;Value=' . $value . ';Modifier=Over;Koef=' . $cells[13]); } }