function crawl_1_page($fil, $url, $chapter) { global $prefix; $c = new Crawler($fil); $c->go_to('id="img"'); $c->readline(); $c->close(); $img = Crawler::extract($c->curline, 'src="', '"'); if ($img) { $fname = Crawler::fix_filename(basename($img)); echo "<a href='{$img}'>{$prefix}-{$chapter}-{$fname}</a><br />\n"; } else { // Ulangi crawl_1_page($url, $url, $chapter); } }
$berhasil = true; $key = $filename; $results[$filename] = $img_url; ?> <a href="<?php echo $val; ?> "><?php echo $key; ?> </a><br /> <?php flush(); } else { } } } } if (isset($start_urlx)) { if (strlen($cfrom) && strlen($cto)) { $start_urlx = Crawler::cutuntillast($start_urlx, '/'); for ($i = $cfrom; $i <= $cto; ++$i) { crawl_1_page($start_urlx . '/' . $i); } } else { crawl_1_page($start_urlx); } } ?> </body> </html>
} } } $line = $c->readline(); preg_match('/Page \\d+ of (\\d+)/', $line, $matches); $n = $matches[1]; $c->close(); for ($i = 2; $i <= $n; $i++) { $ppp = $start_url . 'page/' . $i; echo "URL {$ppp} <br/>\n"; flush(); $c = new Crawler($ppp); $c->go_to('<table'); while ($line = $c->readline()) { if (Crawler::is_there($line, '<h2 class="title">')) { $hasil[] = Crawler::extract($line, '<a href="', '"'); } else { if (Crawler::is_there($line, '<div class="wp-pagenavi">')) { break; } } } $c->close(); } foreach ($hasil as $uri) { crawl_1_page($uri); } } ?> </body> </html>