Beispiel #1
0
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;
}
Beispiel #2
0
function extract_league($Html, $Sport)
{
    $Html = kill_space($Html);
    $Html = numbering_tag($Html, 'div');
    $Html = extract_numbered_tags($Html, 'div', "\r\n", "navElem");
    $TagNo = extract_tagno(copy_be($Html, "<div\t", "&SportID={$Sport}\">"), 'div');
    $Html = extract_numbered_tag($Html, 'div', $TagNo);
    $Html = extract_tags($Html, 'EventGroupID=', "'", ',');
    $Html = str_ireplace('EventGroupID=', '', $Html);
    $Html = str_ireplace("'", '', $Html);
    return $Html;
}
Beispiel #3
0
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;
}
Beispiel #4
0
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;
}
Beispiel #5
0
 private function extract_bets(&$tournir_node, $html, $sport_sign, $tournir_id)
 {
     $this->extract_header($sport_sign);
     $html = kill_space($html);
     $html = numbering_tag($html, 'ul');
     $events = extract_all_numbered_tags($html, 'ul', 'e-td ');
     foreach ($events as $event) {
         $this->extract_main_bets(&$tournir_node, $event, $sport_sign, $tournir_id);
     }
     $events = extract_all_numbered_tags($html, 'ul', 'e-r ');
     foreach ($events as $event) {
         $this->extract_extra_bets(&$tournir_node, $event, $sport_sign, $tournir_id);
     }
 }
Beispiel #6
0
 private function extract_extra_bets(&$tournir_node, $html, $sport_sign, $tournir_id)
 {
     $html = str_ireplace('<li><h2>', '<li class="extra"><h2>', $html);
     $html = numbering_tag($html, 'li');
     $table_rows = extract_all_numbered_tags($html, 'li', 'extra');
     foreach ($table_rows as $row) {
         $row = kill_property($row, 'TagNo');
         $event_id = extract_property_values(copy_be($html, '<ul', '>', 'rel'), 'rel', '');
         $event_node = $this->event_find($tournir_node, $event_id);
         $phrase = copy_be($row, '<h2', '</h2>');
         $phrase = copy_between($phrase, '>', '<');
         $section_node = $this->findSection($sport_sign, $phrase);
         if (!(string) $section_node['Ignore']) {
             $bets = extract_all_tags($row, '<li', '</li>', 'rel');
             foreach ($bets as $bet) {
                 list($label, $koef) = $this->extract_label_koef($bet);
                 $label = str_ireplace((string) $event_node['Gamer1_Name'], 'Gamer1', $label);
                 $label = str_ireplace((string) $event_node['Gamer2_Name'], 'Gamer2', $label);
                 $phrase_node = $this->findPhrase($sport_sign, $phrase, $label);
                 if (!$phrase_node['Ignore']) {
                     $this->addBet($event_node, (string) $phrase_node['BetKind'] . ';Koef=' . $koef);
                 }
             }
         }
     }
 }
Beispiel #7
0
 private function extract_bets(&$tournir_node, $html, $sport_sign, $tournir_id)
 {
     $html = kill_space($html);
     $html = numbering_tag($html, 'table');
     $tables = extract_all_numbered_tags($html, 'table', "foot-market");
     foreach ($tables as $table) {
         $this->extract_header($table, $sport_sign);
         $this->extract_main_bets($tournir_node, $table, $sport_sign, $tournir_id);
     }
 }
Beispiel #8
0
function extract_bets(&$tournir_node, $html, $sport_sign, $tournir_id, $category_id)
{
    $html = str_ireplace('<wbr/>', '', $html);
    $html = numbering_tag($html, 'div');
    $html = extract_numbered_tags($html, 'div', "", "bet-list");
    $html = extract_numbered_tags($html, 'div', "", "dsBodyContent");
    $html = extract_numbered_tags($html, 'div', "", "ControlContent");
    if (in_array($category_id, array(33, 25))) {
        if ($html != '') {
            extract_bets_1x2($tournir_node, $html, $sport_sign, $tournir_id, $category_id);
        }
    } elseif (in_array($category_id, array(28, 30))) {
        if ($html != '') {
            extract_bets_noannotated($tournir_node, $html, $sport_sign, $tournir_id, $category_id);
        }
    } elseif (in_array($category_id, array(35, 36, 524, 31, 190, 266, 271, 1228))) {
        if ($html != '') {
            extract_bets_foratotal($tournir_node, $html, $sport_sign, $tournir_id, $category_id);
        }
    }
    //  file_put_contents("lines/bwin/$sport_sign.$tournir_id.$category_id.html", $html);
}