Updates for scraper errors, still erroring sometimes though.
This commit is contained in:
parent
57da5fed63
commit
41d0d557fb
@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# import all fighters.
|
||||
drush @self.local ev '\Drupal::service("ufc.importer")->importFighters()';
|
||||
ddev drush @self.local ev '\Drupal::service("ufc.import_fighters")->importFighters();';
|
||||
ddev drush @self.local ev '\Drupal::service("ufc.import_fights")->importEvents();';
|
||||
ddev drush @self.local ev '\Drupal::service("ufc.import_fights")->createEvents();';
|
||||
ddev drush @self.local ev '\Drupal::service("ufc.import_fights")->createFights();';
|
||||
|
||||
|
||||
@ -186,7 +186,13 @@ public function setFighterRecord(): void {
|
||||
*/
|
||||
public function setAccuracy(): void {
|
||||
$circles = $this->crawler->filter('.e-chart-circle');
|
||||
if (empty($circles)) {
|
||||
return;
|
||||
}
|
||||
foreach ($circles as $circle) {
|
||||
if (is_null($circle)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($circle->childNodes as $child) {
|
||||
$text = strtolower($child->textContent);
|
||||
if (str_contains($text, "accuracy")) {
|
||||
|
||||
@ -174,8 +174,8 @@ public function loopThroughFighterPages($base_url): void {
|
||||
/* $cid = "ufc:" . $url; */
|
||||
$request = $this->httpClient->request('GET', $url, $headers);
|
||||
$content = $request->getBody()->getContents();
|
||||
$check = strpos($content, "No Result Found For");
|
||||
if (!$check) {
|
||||
$invalid_page = strpos($content, "No Result Found For");
|
||||
if (!$invalid_page) {
|
||||
\Drupal::logger('ufc')->notice("Extracting fighters from page $i.");
|
||||
self::extractFighters($content);
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user