hypeScraper fatal error

When I click edit on a scraper-card to select another image, and then click save, I get the error:

An exception occurred while executing 'INSERT INTO elgg_latest_scraper_data (url, hash, data) VALUES(?, ?, ?)'

and:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'e846a53e02c66aa77048036dbea23cd3384fc753' for key 'hash'

Is there anyone who uses hypeScraper who have experienced anything like this.

(localhost - Elgg 3.x and latest release of hypeScraper from github)

  • Changing the ScraperService.php of this part:

    $qb = Insert::intoTable('scraper_data');
    $qb->setValue('url', $qb->param($url, ELGG_VALUE_STRING))
    ->setValue('hash', $qb->param(sha1($url), ELGG_VALUE_STRING))
    ->setValue('data', $qb->param(serialize($data)));
    
    $result = $this->db->insertData($qb);
     
    On this:
    $dbprefix = elgg_get_config('dbprefix');
    $query = "
    INSERT INTO {$dbprefix}scraper_data
    SET url = :url,
        hash = :hash,
        data = :data
    ON DUPLICATE KEY UPDATE
        data = :data
    ";
    
    $result = $this->db->insertData($query, [
       ':url' => (string) $url,
       ':data' => serialize($data),
       ':hash' => sha1($url),
    ]);
    Made me happy ;)
     
  • Made me happy to, thanks a lot :-)