public static function downloadCSGL_Logos() { $teams = Team::all(); foreach ($teams as $team) { if ($team->logo == null || $team->logo == "no_logo_new.svg") { $team->logo = $team['csgl_name'] . ".jpg"; Scraper::grab_image(DataLoader::$base_img_url . $team['csgl_name'] . ".jpg", "assets/images/teamlogos/" . $team['csgl_name'] . ".jpg"); $team->save(); } } }
public static function getCSGL_Logo($url, $team_name) { $client = Scraper::getClient(); $crawler = $client->request('GET', $url); $div1 = $crawler->filterXPath('//div[@class="team"][1]//@style')->text(); $div2 = $crawler->filterXPath('//div[@class="team"][2]//@style')->text(); $url1 = Scraper::getUrlFromString($div1); $url2 = Scraper::getUrlFromString($div2); if (strpos($url1, $team_name)) { return $url1; } else { return $url2; } }