Browse Source

fix crontab scrape

main
ghost 1 year ago
parent
commit
c50e3a777b
  1. 9
      src/crontab/scrape.php

9
src/crontab/scrape.php

@ -57,10 +57,10 @@ try {
foreach ($db->getMagnetToAddressTrackerScrapeQueue(CRAWLER_SCRAPE_QUEUE_LIMIT) as $queue) foreach ($db->getMagnetToAddressTrackerScrapeQueue(CRAWLER_SCRAPE_QUEUE_LIMIT) as $queue)
{ {
$hash = []; $hashes = [];
foreach ($db->findMagnetToInfoHashByMagnetId($queue->magnetId) as $result) foreach ($db->findMagnetToInfoHashByMagnetId($queue->magnetId) as $result)
{ {
$hash[] = $db->getInfoHash($result->infoHashId)->value; $hashes[] = $db->getInfoHash($result->infoHashId)->value;
} }
if ($addressTracker = $db->getAddressTracker($queue->addressTrackerId)) if ($addressTracker = $db->getAddressTracker($queue->addressTrackerId))
@ -78,7 +78,9 @@ try {
$host->value, $host->value,
$uri->value); $uri->value);
if ($scrape = $scraper->scrape($hash, [$url], null, 1)) foreach ($hashes as $hash)
{
if ($scrape = $scraper->scrape([$hash], [$url], null, 1))
{ {
$db->updateMagnetToAddressTrackerTimeOffline( $db->updateMagnetToAddressTrackerTimeOffline(
$queue->magnetToAddressTrackerId, $queue->magnetToAddressTrackerId,
@ -121,6 +123,7 @@ try {
} }
} }
} }
}
$db->commit(); $db->commit();

Loading…
Cancel
Save