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.

25 lines
792 B

  1. <?php
  2. // Sufficiently Remarkable
  3. if (!is_dir('sufficientlyremarkable')) {
  4. mkdir('sufficientlyremarkable');
  5. }
  6. $url = 'http://sufficientlyremarkable.com/';
  7. while ($url) {
  8. $html = file_get_contents($url);
  9. preg_match("/data-current_comic_id=['\"]([0-9]+)['\"]/", $html, $idMatch);
  10. preg_match('/src=[\'"]([^\'"]+)[\'"] class="comic"/', $html, $matches);
  11. $name = basename($matches[1]);
  12. if (!is_file("sufficientlyremarkable/{$idMatch[1]}-{$name}")) {
  13. $data = file_get_contents($matches[1]);
  14. echo "Downloading {$idMatch[1]}-{$name}\n";
  15. file_put_contents("sufficientlyremarkable/{$idMatch[1]}-{$name}", $data);
  16. }
  17. preg_match('/class="comicPagination nav-prev" href="([^"]+)"/', $html, $urlMatch);
  18. $url = @$urlMatch[1];
  19. usleep(5e5);
  20. }