Files
nuhodds_fi4/app/Console/Commands/Grapper/Betica.php
T
2026-01-15 18:20:54 +01:00

140 lines
4.5 KiB
PHP

<?php
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
class Betica
{
public static function switch()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note(Nuh::$options['provider']['name'], 'g');
}
/**
* periods
* -1 Today
* -2 Next 48hrs
* 1 Tomorrow
* 2 Saturday
* 3 Sunday
* 4 Monday
* 5 Tuesday
* 6 Wednesday
* 7 Thursday
* 8 Next Week
* 9 All
*/
/**
* sort_options
* 1 Highlights
* 2 Start time
* 3 Top leagues
*/
/**
* with limit
* https://api.betika.com/v1/uo/matches?page=1&limit=10&tab=&sub_type_id=1,10,18,29&sport_id=14&tag_id=&sort_id=1&period_id=-1&esports=false
*
* ohne limit comes 100,
* https://api.betika.com/v1/uo/matches?page=1&tab=&sub_type_id=1,10,18,29&sport_id=14&tag_id=&sort_id=1&period_id=9&esports=false
*
* in meta tag are the totals
* "meta": {"total": "1053",
*
* loop max 100
*/
/**
* bettypes
* 1 => 1X2
* 10 => DOUBLE CHANCE
* 18 => TOTAL
* 19 => BOTH TEAMS TO SCORE (GG/NG)
* sub_type_id=1,10,18,29
*/
/**
* TOR exit nodes
* TANZANIA, UNITED REPUBLIC OF {tz}
* KENYA {ke}
* UGANDA {ug}
* SOMALIA ? {so}
* ETHIOPIA {et}
*
* ExitNodes {ke},{tz},{ug},{et}
* vi /etc/tor/torrc
*/
for ($page = 1; $page < 20; $page++) {
$url = "https://api.betika.com/v1/uo/matches?page=$page&limit=100&sub_type_id=1,10,18,29&sport_id=14&sort_id=2&period_id=9&esports=false";
$data = Curl::load($url);
if (! is_array($data['data']) or \count($data['data']) == 0) {
if ($debug) {
Notice::note('NO DATA', 'r');
}
return;
} else {
$total = $data['meta']['total'];
if ($debug) {
Notice::note('Total: '.$total, 'b');
}
foreach ($data['data'] as $row) {
print_r($row);
if (isset($row['parent_match_id']) && ! $row['is_esport']) {
$event = [
'event_id' => (int) $row['match_id'],
'betradar_id' => (int) $row['parent_match_id'] ?? 0,
'sport_id' => (int) Nuh::$options['sport_id'],
'provider_id' => (int) Nuh::$options['provider_id'],
'starttime' => (string) $row['start_time'],
'country' => $row['category'] ?? 0,
'home' => $row['home_team'] ?? '',
'away' => $row['away_team'] ?? '',
'group' => $row['competition_name'] ?? '',
'group_id' => (int) $row['competition_id'] ?? 0,
];
dd($event);
FindFixture::search($event, self::$groups[$sport_id], self::$elements[$sport_id]);
}
// $bmoid = (int) $value['match_id'];
// $event = [];
// $event['status'] = 1;
// $event['bkmid'] = PARSER::$_config['bookmaker_id'];
// $event['bmoid'] = (int) $bmoid;
// $event['sportid'] = 1;
// $event['brmatchid'] = (int) $value['parent_match_id'];
// $event['starttime'] = strtotime($value['start_time']);
// $event['starttime'] -= 10800;
// $event['event'] = $value['home_team'].' v '.$value['away_team'];
// $event['groupname'] = $value['competition_name'];
// $event['groupid'] = $value['competition_id'];
// $event['country'] = $value['category'];
// $event['home'] = $value['home_team'];
// $event['away'] = $value['away_team'];
}
}
}
}
}