You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

  1. <?php
  2. // Alice Grove
  3. // This one is finished, and Jeph re-hosted it as a single sequential list of
  4. // files, so we're no longer reliant on scraping the Tumblr blog!
  5. // Sadly there are lots of weird things about the setup here that Jeph didn't
  6. // account for, his pages don't even fully load all the comics!
  7. if (!is_dir('alicegrove')) {
  8. mkdir('alicegrove');
  9. }
  10. // We're using spread operators in an array here, which requires PHP 7.4+
  11. $jpegs = [
  12. 35, 70, 78, 83, 84, 98,
  13. 100, 107, 113, 124, ...range(126, 132), 134, 136, 141, 145,
  14. 153, 159, 164, ...range(168, 183), 186, 196,
  15. ];
  16. $jpegs = array_merge($jpegs, );
  17. for ($i = 1; $i <= 205; $i++) {
  18. // 109 and 165 are unique, 137 doesn't exist :P
  19. if (in_array($i, [109, 165, 137])) continue;
  20. $ext = in_array($i, $jpegs) ? 'jpg' : 'png';
  21. $path = "alicegrove/$i.$ext";
  22. if (!is_file($path)) {
  23. $url = "https://www.questionablecontent.net/images/alice/$i.$ext";
  24. echo "Downloading $i.$ext\n";
  25. file_put_contents($path, file_get_contents($url));
  26. usleep(5e5);
  27. }
  28. }
  29. // Handle non-standard images
  30. $extra = ['109-1.jpg', '109-2.png', '165-1.png', '165-2.jpg'];
  31. foreach ($extra as $img) {
  32. $path = "alicegrove/$img";
  33. if (!is_file($path)) {
  34. $url = "https://www.questionablecontent.net/images/alice/$img";
  35. echo "Downloading $img\n";
  36. file_put_contents($path, file_get_contents($url));
  37. usleep(5e5);
  38. }
  39. }