Browse Source

Handle sequence interruptions in Nerf NOW!!

Fixes #19
master
Alan Hardman 1 year ago
parent
commit
3244b4d00f
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      nerfnow.php

+ 5
- 1
nerfnow.php View File

@@ -28,6 +28,10 @@ for ($i = $start; $i > 0; $i--) {

echo "Downloading #$i\n";
$html = file_get_contents('http://www.nerfnow.com/comic/' . $i);
if (!$html) {
echo "Unable to load page, skipping...\n";
continue;
}
preg_match('@/img/([0-9]+)/([0-9]+\\.[a-z]{3,4})@', $html, $matches);

$url = "http://www.nerfnow.com/img/$i/{$matches[2]}";
@@ -36,5 +40,5 @@ for ($i = $start; $i > 0; $i--) {
file_put_contents("nerfnow/$i-{$matches[2]}", $data);
}

usleep(500000);
usleep(5e5);
}

Loading…
Cancel
Save