Example #1
0
function crawl_1_chapter($url, $chapter)
{
    global $sitename;
    global $prefix;
    $c = new Crawler($url);
    $c->go_to('name="pagejump"');
    $pages = array();
    while ($line = $c->readline()) {
        if (Crawler::is_there($line, '<option')) {
            $pages[] = Crawler::extract($line, 'value="', '"');
        } else {
            if (Crawler::is_there($line, '</select>')) {
                break;
            }
        }
    }
    $c->go_to('id="nextpage"');
    $c->readline();
    $img = $c->getbetween('src="', '"');
    $c->close();
    $img_base = dirname($img);
    $ext = '.jpg';
    $chapter = Crawler::pad($chapter, 3);
    foreach ($pages as $page) {
        echo "<a href='{$img_base}/{$page}{$ext}'>{$prefix}-{$chapter}-{$page}{$ext}</a><br/>\n";
        flush();
    }
    //print_r($pages);flush();
}
 public function mangareader_1_page($fil, $url, $prefix, $chapter)
 {
     $chapter = Crawler::pad($chapter, 3);
     $c = new Crawler($fil);
     $c->go_to('width="800"');
     $img = $c->getbetween('src="', '"');
     preg_match('/(\\d+\\.\\w+)$/', basename($img), $m);
     $iname = $m[1];
     $c->close();
     $name = $prefix . '-' . $chapter . '-' . $iname;
     return array($name => $img);
 }
Example #3
0
 public function mangareader_1_page($fil, $url, $chapter)
 {
     $prefix = $this->prefix;
     $chapter = Crawler::pad($chapter, 3);
     $c = new Crawler($fil);
     $c->go_to('width="800"');
     $img = $c->getbetween('src="', '"');
     // if (@$_GET['show_url']) echo "<a href='$url'>URL</a> ";
     preg_match('/(\\d+\\.\\w+)$/', basename($img), $m);
     $iname = $m[1];
     echo '<li><a href="' . $img . '">' . $prefix . '-' . $chapter . '-' . $iname . '</a>' . "</li>\n";
     $c->close();
 }
Example #4
0
function crawl_1_chapter($url, $chapter)
{
    global $sitename;
    global $prefix;
    // http://ani-haven.net/hr-alpha/Psyren/145/
    // @todo
    $chapter = Crawler::pad($chapter, 3);
    $c = new Crawler($url);
    $c->go_to('id="myselectbox3"');
    $c->readline();
    $pages = Crawler::extract_to_array($c->curline, 'value="', '"');
    $c->close();
    // append $url ke $pages
    foreach ($pages as $i => $page) {
        $pages[$i] = $url . $page;
    }
    Crawler::multiProcess(4, $pages, 'crawl_1_page', array($chapter));
}
 public function go()
 {
     $mark1 = '<a target="_blank" title="Show fullsized image" href=';
     $mark2 = '<a title="Next Image" rel="next" href=';
     $host = 'http://lu.scio.us';
     $finish = false;
     $number = 0;
     $url = $this->url;
     preg_match('/\\/([^\\/]+)\\/page\\/1/', $url, $m);
     $text = $m[1];
     while (!$finish) {
         echo $url . "<br/>\n";
         flush();
         $c = new Crawler($url);
         $c->go_to('id="pid_');
         while ($line = $c->readline()) {
             if (Crawler::is_there($line, 'src="')) {
                 $img = Crawler::extract($line, 'src="', '"');
                 $img = str_replace('thumb_100_', @$_GET['big'] ? '' : 'normal__', $img);
                 $num = Crawler::pad(++$number, 3);
                 $filnm = basename($img);
                 $ext = Crawler::cutafter($filnm, '.');
                 // $text = $num . $ext;
                 // preg_match('/\/(\d+\/\d+)\//', $img, $m);
                 // $text = $m[1];
                 echo "<a href='{$img}'>{$text}</a><br/>\n";
                 flush();
             } else {
                 if (Crawler::is_there($line, '</ul>')) {
                     break;
                 }
             }
         }
         $c->go_to('class="pager"');
         $c->readline();
         if (Crawler::is_there($c->curline, 'Pager_next')) {
             $finish = false;
             $url = $host . Crawler::extract($c->curline, '<a rel="next" href="', '"');
         } else {
             $finish = true;
         }
         $c->close();
     }
 }
Example #6
0
 public function go()
 {
     // http://www.fakku.net/viewonline.php?id=2589
     // pake curl
     $base = 'http://www.fakku.net';
     // $this->url = str_replace('viewmanga.php', 'viewonline.php', $this->url);
     if (!preg_match('/\\/read$/', $this->url)) {
         $this->url .= '/read';
     }
     /*
     $ch = curl_init($this->url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     file_put_contents('fakku.temp', curl_exec($ch));
     curl_close($ch);
     */
     $craw = new Crawler($this->url, array('use_curl' => true, 'agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13'));
     $craw->go_to('var data = {');
     $json = Crawler::extract($craw->curline, ' = ', ';');
     $obj = json_decode($json);
     /*
     $craw->go_to('var mirror = ');
     $mirror = $craw->getbetween("'", "'");
     $craw->go_to('var mirror = ');
     $mirror2 = $craw->getbetween("'", "'");
     if ($mirror2) $mirror = $mirror2;
     */
     // 2012-05-06 fakku berubah
     $craw->go_to('function imgpath(');
     $craw->go_to('return \'');
     $imgpath = $craw->getbetween("return '", "';");
     $craw->close();
     $dir = basename(dirname($this->url));
     foreach ($obj->thumbs as $key => $val) {
         $filename = Crawler::pad($key + 1, 3);
         // $img = $mirror . '/' . $obj->meta->dir . 'images/' . $filename;
         $img = str_replace("' + x + '", $filename, $imgpath);
         $text = $dir;
         echo "<a href='{$img}'>{$text}</a><br/>\n";
         flush();
     }
 }
Example #7
0
function foolreader_1_chapter($url, $chapter)
{
    global $sitename;
    global $prefix;
    $chapter = Crawler::pad($chapter, 3);
    $c = new Crawler($url);
    $c->go_to('imageArray = new Array');
    while ($line = $c->readline()) {
        if (Crawler::is_there($line, 'imageArray[')) {
            $img = Crawler::extract($line, "'", "'");
            if (strpos($img, 'http://') !== 0) {
                $img = $sitename . $img;
            }
            $fname = basename($img);
            echo "<a href='{$img}'>{$prefix}-{$chapter}-{$fname}</a><br/>\n";
        } else {
            if (Crawler::is_there($line, 'function loadImage')) {
                break;
            }
        }
    }
    $c->close();
    /*
    // @TODO
    $pages = array();
    while ($line = $c->readline()) {
    	if (Crawler::is_there($line, '<option')) {
    		$pages[] = $sitename . Crawler::extract($line, 'value=\'', "'");
    	} else if (Crawler::is_there($line, '</select>')) {
    		break;
    	}
    }
    //$pages = Crawler::extract_to_array($c->curline, 'value="', '"');
    $c->close();
    
    //Crawler::multiProcess(4, $pages, 'foolreader_1_page', array($chapter));
    */
}
Example #8
0
function omfggscans_chapters($chapters, $infixs)
{
    global $base;
    global $sitename;
    global $prefix;
    foreach ($chapters as $key => $val) {
        $url = $base . "&c={$val}";
        $ifx = Crawler::pad($infixs[$key], 3);
        echo "{$url}<br/>\n";
        $c = new Crawler($url);
        // retrieve pages
        $c->go_to("name='page'");
        $pages = array();
        while ($line = $c->readline()) {
            if (Crawler::is_there($line, '<option')) {
                $pg = Crawler::extract($line, "value='", "'");
                $pgtext = Crawler::extract($line, "'>", "</");
                $pages[$pg] = $pgtext;
            } else {
                if (Crawler::is_there($line, '</select>')) {
                    break;
                }
            }
        }
        // sample image url
        $c->go_to("class='manga-img'");
        $src = Crawler::extract($c->curline, 'src="', '"');
        $pre_src = dirname($src) . '/';
        $post_src = '.png';
        $c->close();
        foreach ($pages as $k => $v) {
            $href = $pre_src . $v . $post_src;
            $text = "{$prefix}-{$ifx}-{$v}{$post_src}";
            echo "<a href='{$href}'>{$text}</a><br />\n";
        }
    }
}