centralized grapper tournaments wi

This commit is contained in:
salam committed 2026-10-11 15:42:00 +02:00
1 parent 34701ecbff
commit db917bdc92
8 files changed
+379 -173

No files matched your search

+43 -4
View File
@@ -20,25 +20,52 @@ trait GrappingTournaments
{
$sport_id = 1;
$has = SofaScoreDayTournament::where('day', $day)->first();
if ($this->debug) {
Notice::note('⚽ tournaments for day '.$day);
Notice::note('⚽ close all vpn');
}
exec('killall ssh');
$slug = 'football';
if ($this->debug) {
Notice::note('⚽ open vpn');
}
exec('ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190');
/**
* SofaScoreDayTournament
*/
if ($this->debug) {
Notice::note('get tournaments', 'g');
}
if (! $this->force && $has) {
$this->day_tournaments = SofaScoreDayTournament::where('day', $day)->get();
if (! $this->restart && $this->day_tournaments->count() > 0) {
if ($this->debug) {
Notice::note("$day Tournaments allready grapped", 'bb');
}
if ($this->debug) {
Notice::note('⚽ close all vpn');
}
exec('killall ssh');
return;
} else {
$page = 1;
$tournaments_counter = 0;
$slug = 'football';
while ($page) {
// $data = $this->curl($url);
if ($this->debug) {
Notice::note('⚽ close all vpn and load tournaments');
}
$this->sleep();
$url = $this->base_url . "api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
$url = $this->base_url."api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
$cloudflareService = new CloudflareSolverService;
@@ -158,6 +185,18 @@ trait GrappingTournaments
if ($this->debug) {
Notice::note("$day Tournaments loaded", 'bb');
}
if ($this->debug) {
Notice::note('⚽ close all vpn');
}
$this->day_tournaments = SofaScoreDayTournament::where('day', $day)->get();
if ($this->debug) {
Notice::note('⚽ close all vpn');
}
exec('killall ssh');
}
}
}