Browse Source

Adding completed Jay Naylor comics

master
Alan Hardman 1 year ago
parent
commit
da0ff2e830
3 changed files with 98 additions and 0 deletions
  1. +2
    -0
      .gitignore
  2. +48
    -0
      betterdays.php
  3. +48
    -0
      originallife.php

+ 2
- 0
.gitignore View File

@@ -1,4 +1,5 @@
/alicegrove/
/betterdays/
/blasternation/
/crashzoom/
/doa/
@@ -16,6 +17,7 @@
/loadingartist/
/nerfnow/
/octopuspie/
/originallife/
/qc/
/sandraandwoo/
/sleeplessdomain/


+ 48
- 0
betterdays.php View File

@@ -0,0 +1,48 @@
<?php
// Better Days
// By Jay Naylor, completed in 2009. Custom site.

$html = file_get_contents('http://jaynaylor.com/betterdays/');
preg_match('@/betterdays/comic/(.+\\.(jpg|png|gif))@', $html, $matches);

if (empty($matches[1])) {
echo "No comic found on home page! :(\n";
return;
}

if (!is_dir('betterdays')) {
mkdir('betterdays');
}

// Download current page's comic, load previous comic webpage, repeat
while (true) {
echo "Downloading {$matches[1]}\n";
$url = "http://jaynaylor.com/betterdays/comic/{$matches[1]}";
$data = @file_get_contents($url);
if ($data) {
file_put_contents("betterdays/{$matches[1]}", $data);
}

// Find previous page link
$regex = '@href="(http://jaynaylor.com/betterdays/archives/[0-9A-Za-z/_-]+\.html)">&laquo; Previous@';
preg_match($regex, $html, $prevMatch);

if (empty($prevMatch[1])) {
echo "No previous URL found!\n";
return;
}

$html = @file_get_contents($prevMatch[1]);
if (!$html) {
echo "Failed to load previous page!\n";
return;
}

preg_match('@/betterdays/comic/(.+\\.(jpg|png|gif))@', $html, $matches);
if (empty($matches[1])) {
echo "No image found on page!\n";
return;
}

usleep(5e5);
}

+ 48
- 0
originallife.php View File

@@ -0,0 +1,48 @@
<?php
// Original Life
// By Jay Naylor, probably complete, or at least abandoned. Custom site.

$html = file_get_contents('http://jaynaylor.com/originallife/');
preg_match('@/originallife/comic/(.+\\.(jpg|png|gif))@', $html, $matches);

if (empty($matches[1])) {
echo "No comic found on home page! :(\n";
return;
}

if (!is_dir('originallife')) {
mkdir('originallife');
}

// Download current page's comic, load previous comic webpage, repeat
while (true) {
echo "Downloading {$matches[1]}\n";
$url = "http://jaynaylor.com/originallife/comic/{$matches[1]}";
$data = @file_get_contents($url);
if ($data) {
file_put_contents("originallife/{$matches[1]}", $data);
}

// Find previous page link
$regex = '@href="(http://jaynaylor.com/originallife/archives/[0-9A-Za-z/_-]+\.html)">&laquo; Previous@';
preg_match($regex, $html, $prevMatch);

if (empty($prevMatch[1])) {
echo "No previous URL found!\n";
return;
}

$html = @file_get_contents($prevMatch[1]);
if (!$html) {
echo "Failed to load previous page!\n";
return;
}

preg_match('@/originallife/comic/(.+\\.(jpg|png|gif))@', $html, $matches);
if (empty($matches[1])) {
echo "No image found on page!\n";
return;
}

usleep(5e5);
}

Loading…
Cancel
Save