This commit is contained in:
salam committed 2026-07-10 08:30:50 +02:00
1 parent 1905440212
commit fc0f18ba73
6 files changed
+40 -73

No files matched your search

@@ -46,7 +46,7 @@ class DaysTournament
while ($page) {
$url = Nuh::$options['base_url']."api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
$url = Nuh::$options['base_url'] . "api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
Sleeper::rand($langsam);
@@ -66,10 +66,6 @@ class DaysTournament
$tournament = $row['tournament'];
}
if ($debug) {
Notice::note($tournament, 'g');
}
$category = $tournament['category'];
if ($sport_id == 5) {
@@ -151,7 +147,7 @@ class DaysTournament
$tournaments_counter++;
if ($debug) {
Notice::note('tournament: '.$tournament['name'], 'p');
Notice::note('tournament: ' . $tournament['name'], 'p');
}
/**
@@ -169,7 +165,8 @@ class DaysTournament
}
}
}
Notice::note('days tournament done', 'g');
if ($debug) {
Notice::note('days tournament done', 'g');
}
}
}
@@ -17,7 +17,7 @@ class Grapper
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$task_id = Nuh::$options['task'] ?? 0;
$days = LoadDays::load();
@@ -36,14 +36,14 @@ class Grapper
$day = $d['day'];
$res = SofaScoreDayTournament::whereDate('day','=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
$res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
if($res){
if ($res) {
if ($debug) {
Notice::note($day, 'g');
}
}
$url = Nuh::$options['base_url']."api/v1/unique-tournament/$tournament->sofa_score_tournament_id/scheduled-events/$day";
$url = Nuh::$options['base_url'] . "api/v1/unique-tournament/$tournament->sofa_score_tournament_id/scheduled-events/$day";
Sleeper::rand(1);
@@ -57,7 +57,7 @@ class Grapper
foreach ($data['events'] as $event) {
$folder = Sofascore::$grapper_path.$day.'/'.$event['tournament']['slug'].'/'.$event['slug'];
$folder = Sofascore::$grapper_path . $day . '/' . $event['tournament']['slug'] . '/' . $event['slug'];
File::makeDirectory($folder, 0775, true, true);
@@ -65,7 +65,7 @@ class Grapper
* EVENT event
*********************************/
File::put($folder.'/event.json', json_encode($event));
File::put($folder . '/event.json', json_encode($event));
/*********************************
* EVENT statistics
@@ -73,9 +73,9 @@ class Grapper
$event_id = $event['id'];
if(!File::exists($folder.'/statistics.json')){
if (!File::exists($folder . '/statistics.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/statistics";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/statistics";
Sleeper::rand($langsam);
@@ -83,16 +83,16 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/statistics.json', json_encode($data));
File::put($folder . '/statistics.json', json_encode($data));
}
/*********************************
* EVENT lineups
*********************************/
if(!File::exists($folder.'/lineups.json')){
if (!File::exists($folder . '/lineups.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/lineups";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/lineups";
Sleeper::rand($langsam);
@@ -100,16 +100,16 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/lineups.json', json_encode($data));
File::put($folder . '/lineups.json', json_encode($data));
}
/*********************************
* EVENT odds
*********************************/
if(!File::exists($folder.'/odds.json')){
if (!File::exists($folder . '/odds.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/odds/1/all";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/odds/1/all";
Sleeper::rand($langsam);
@@ -117,16 +117,16 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/odds.json', json_encode($data));
File::put($folder . '/odds.json', json_encode($data));
}
/*********************************
* EVENT incidents
*********************************/
if(!File::exists($folder.'/incidents.json')){
if (!File::exists($folder . '/incidents.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/incidents";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/incidents";
Sleeper::rand($langsam);
@@ -134,13 +134,15 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/incidents.json', json_encode($data));
File::put($folder . '/incidents.json', json_encode($data));
}
}
}
}
}
Notice::note('tournament done', 'bb');
if ($debug) {
Notice::note('tournament done', 'bb');
}
}
}
}
@@ -12,20 +12,20 @@ class LoadDays
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$task_id = Nuh::$options['task'] ?? 0;
$dates = [];
if(!$task_id){
if (!$task_id) {
Notice::note('no task id', 'br');
return [];
}
$task = SofaScoreTask::with('sport')->where('id', $task_id)->first();
if(!$debug){
Notice::note('grapper: '.$task->mode.' sport: '.$task->sport_id);
if ($debug) {
Notice::note('LoadDays ' . $task->mode . ' sport: ' . $task->sport_id);
}
switch ($task->mode) {
@@ -78,13 +78,13 @@ class LoadDays
}
if (! $dates) {
Notice::note(__FILE__.PHP_EOL.'no dates', 'r', 1);
Notice::note(__FILE__ . PHP_EOL . 'no dates', 'r', 1);
}
// remove when element in array is double (day and slug)
$dates = array_unique($dates, SORT_REGULAR);
return $dates;
}
@@ -11,6 +11,11 @@ class LoadTournaments
public static function load()
{
$sport_id = Nuh::$options['sport_id'];
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('LoadTournaments, sport: ' . $sport_id);
}
$tornaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get();