本文整理汇总了PHP中Page::go_line方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::go_line方法的具体用法?PHP Page::go_line怎么用?PHP Page::go_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::go_line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crawl_chapter
public function crawl_chapter($v)
{
$ifx = Text::create($v['infix'])->pad(3)->to_s();
$prefix = $this->prefix;
$p = new Page($v['url']);
// grab total page
$p->go_line('id="top_bar"');
$p->go_line_regex('/of \\d+\\w+/');
$tot = $p->curr_line()->regex_match('/of (\\d+)/');
$tot = $tot[1];
// grab first image
$p->go_line('id="viewer"');
$p->next_line(2);
$src = $p->curr_line()->cut_between('src="', '"');
$name = basename($src);
echo "<a href='{$src}'>{$prefix}-{$ifx}-{$name}</a><br>\n";
// iterate
for ($i = 2; $i <= $tot; $i++) {
$p = new Page(dirname($v['url']) . '/' . $i . '.html');
$p->go_line('id="viewer"');
$p->next_line(2);
$src = $p->curr_line()->cut_between('src="', '"');
$name = basename($src);
echo "<a href='{$src}'>{$prefix}-{$ifx}-{$name}</a><br>\n";
}
}
示例2: get_images
public function get_images($chapter_url, $prefix, $infix)
{
$ifx = Text::create($infix)->pad(3)->to_s();
$sitename = "http://mangahead.com";
$pref = Text::create($chapter_url);
if (!$pref->contain('index.php')) {
$pref = $pref->replace($sitename . '/Manga', $sitename . '/index.php/Manga');
}
$finish = false;
if ($pref->contain('?page=')) {
$page = (int) $pref->cut_after('?page=')->to_s();
$pref = $pref->cut_until('?page=');
} else {
$page = 1;
}
$pages = array();
while (!$finish) {
// file_put_contents('/tmp/head', $chapter_url."\n", FILE_APPEND);
$p = new Page($chapter_url);
$p->go_line('<blockquote>');
if ($p->curr_line()->contain(' ›')) {
$finish = false;
$chapter_url = $pref . '/?page=' . ++$page;
} else {
$finish = true;
}
$srcs = $p->curr_line()->extract_to_array('<img src="', '"');
foreach ($srcs as $src) {
$parturl = Text::create($src)->replace('index.php', 'mangas')->replace('?action=thumb', '')->to_s();
$name = basename($parturl);
$pages["{$prefix}-{$ifx}-{$name}"] = $sitename . $parturl;
}
}
return $pages;
}
示例3: grab_chapter_infix
public function grab_chapter_infix($url)
{
$p = new Page($url);
$p->go_line('id="gotoMangaInfo"');
$m = $p->curr_line()->regex_match('/Chapter (\\w*)<\\//');
return $m[1];
}
示例4: collect_images
private function collect_images($url, $dir)
{
$continue = true;
$domain = 'http://rule34.xxx/';
$base = 'http://rule34.xxx/index.php';
do {
echo $url . "\n";
$p = new Page($url);
$p->go_line('class="thumb"');
do {
if ($p->curr_line()->contain('href="')) {
$href = $p->curr_line()->cut_between('href="', '"')->to_s();
$href = htmlspecialchars_decode($href);
echo "{$domain}{$href}\n";
$p2 = new Page($domain . $href);
$p2->go_line('Original image');
$src = $p2->curr_line()->cut_between('href="http:', '"')->to_s();
$src = 'http:' . $src;
$outpath = $dir . basename($src);
download_it($src, $outpath, "--header=\"Accept: image/*\"");
// echo '<pre>'.htmlspecialchars($p2->curr_line()).'</pre>';
}
} while (!$p->next_line()->contain('<center>'));
$p->reset_line();
$p->go_line('id="paginator"');
if ($p->curr_line()->contain('alt="next"')) {
$m = $p->curr_line()->regex_match('/href="([^"]+)" alt="next"/');
$url = $base . html_entity_decode($m[1]);
} else {
$continue = false;
}
} while ($continue);
}
示例5: get_images
public function get_images($chapter_url, $prefix, $infix)
{
$ifx = Text::create($infix)->pad(3)->to_s();
$p = new Page($chapter_url);
// grab total page
$p->go_line('id="top_bar"');
$p->go_line_regex('/of \\d+\\w+/');
$tot = $p->curr_line()->regex_match('/of (\\d+)/');
$tot = $tot[1];
// grab first image
$p->go_line('id="viewer"');
$p->next_line(2);
$src = $p->curr_line()->cut_between('src="', '"');
$name = basename($src);
$result = array("{$prefix}-{$ifx}-{$name}" => $src);
for ($i = 2; $i <= $tot; $i++) {
$p = new Page(dirname($chapter_url) . '/' . $i . '.html');
$p->go_line('id="viewer"');
$p->next_line(2);
$src = $p->curr_line()->cut_between('src="', '"');
$name = basename($src);
$result["{$prefix}-{$ifx}-{$name}"] = $src;
}
return $result;
}
示例6: extract
public function extract($columns, $s, $n, $url)
{
$result = array();
$pattern_url = 'http://nn4b.com/?webcomic1=%s';
for ($i = $s; $i <= $n; $i++) {
$purl = sprintf($pattern_url, $i);
$p = new Page($purl);
$p->go_line('"og:image"');
$src = $p->curr_line()->cut_between('content="', '"')->to_s();
$p->reset_line();
$p->go_line("link rel='next'");
$next = $p->curr_line()->cut_between("href='", "'")->to_s();
$item = array('image' => "<img src='{$src}'>", 'link' => "<a href='{$purl}'>Link</a>", 'next' => "<a href='{$next}'>Next</a>");
$result[] = $item;
}
return $result;
}
示例7: crawl_page
public function crawl_page($url, $ifx)
{
$p = new Page($url);
$p->go_line('data[pages]');
$pages = array();
do {
$line = $p->curr_line();
if ($line->contain('</option>')) {
$pages[] = $line->cut_between('>', '</option')->to_s();
}
} while (!$p->next_line()->contain('</select>'));
$p->go_line('scanlations');
$imgurl = $p->curr_line()->cut_between('<img src="', '"')->to_s();
$imgbase = dirname($imgurl);
foreach ($pages as $page) {
echo "<a href='{$imgbase}/{$page}'>{$this->prefix}-{$ifx}-{$page}</a><br/>\n";
}
}
示例8: crawl_chapter
public function crawl_chapter($v)
{
$ifx = Text::create($v['infix'])->pad(3)->to_s();
$p = new Page($v['url']);
// grab total page
$p->go_line('select class="cbo_wpm_pag"');
$p->next_line();
$p->go_line('select class="cbo_wpm_pag"');
$pages = $p->curr_line()->extract_to_array('value="', '"');
// grab first image
$p->reset_line();
$this->crawl_page($p, $ifx);
// iterate
array_shift($pages);
foreach ($pages as $page) {
$purl = $v['url'] . $page . '/';
$q = new Page($purl);
$this->crawl_page($q, $ifx);
}
}
示例9: get_images
public function get_images($chapter_url, $prefix, $infix)
{
$ifx = Text::create($infix)->pad(3)->to_s();
$p = new Page($chapter_url);
// grab total page
$p->go_line('select class="cbo_wpm_pag"');
$p->next_line();
$p->go_line('select class="cbo_wpm_pag"');
$pages = $p->curr_line()->extract_to_array('value="', '"');
// grab first image
$p->reset_line();
$result = $this->crawl_page($p, $prefix, $ifx);
// iterate
array_shift($pages);
foreach ($pages as $page) {
$purl = $chapter_url . $page . '/';
$q = new Page($purl);
$result = $result + $this->crawl_page($q, $prefix, $ifx);
}
return $result;
}
示例10: collect_streams
private function collect_streams($url)
{
$p = new Page($url);
$p->go_line('"streams":[{');
$json_part = $p->curr_line()->cut_between('"streams":[{', '}]');
$streams = '[{' . $json_part . '}]';
$streams = json_decode($streams);
$result = array();
foreach ($streams as $stream) {
$result[] = (object) array('res' => $stream->width . 'x' . $stream->height, 'url' => $stream->host . $stream->path, 'ext' => $stream->format);
}
return $result;
}
示例11: crawl_chapter
public function crawl_chapter($v)
{
$ifx = Text::create($v['infix'])->pad(3)->to_s();
$p = new Page($v['url']);
// grab list of pages
$p->go_line('="changePage(');
$pages = $p->curr_line()->extract_to_array('href="', '"');
// grab current image
$this->crawl_page($p, $ifx);
array_shift($pages);
foreach ($pages as $purl) {
$this->crawl_page(new Page($purl), $ifx);
}
}
示例12: get_images
public function get_images($chapter_url, $prefix, $infix)
{
$ifx = Text::create($infix)->pad(3)->to_s();
$p = new Page($chapter_url);
// grab list of pages
$p->go_line('="changePage(');
$pages = $p->curr_line()->extract_to_array('href="', '"');
// grab current image
$result = $this->crawl_page($p, $prefix, $ifx);
array_shift($pages);
foreach ($pages as $purl) {
$result = $result + $this->crawl_page(new Page($purl), $prefix, $ifx);
}
return $result;
}
示例13: crawl_chapter
public function crawl_chapter($v)
{
$ifx = Text::create($v['infix'])->pad(3)->to_s();
$p = new Page($v['url']);
// grab list of pages
$p->go_line('Last Page (');
$n = $p->curr_line()->cut_between('Last Page (', ')')->to_s();
$dir_url = dirname($v['url']);
// grab current image
$this->crawl_page($p, $ifx, 1);
for ($i = 2; $i <= $n; $i++) {
$p = new Page($dir_url . '/' . $i);
$this->crawl_page($p, $ifx, $i);
}
}
示例14: get_images
public function get_images($chapter_url, $prefix, $infix)
{
$ifx = Text::create($infix)->pad(3)->to_s();
$p = new Page($chapter_url);
// grab list of pages
$p->go_line('id="page_select"');
$pages = $p->next_line()->extract_to_array('value="', '"');
// grab current image
$result = $this->crawl_page($p, $prefix, $ifx, 1);
array_shift($pages);
foreach ($pages as $i => $purl) {
$p = new Page($purl);
$result = $result + $this->crawl_page($p, $prefix, $ifx, $i + 2);
}
return $result;
}
示例15: crawl_chapter
public function crawl_chapter($v)
{
$ifx = Text::create($v['infix'])->pad(3)->to_s();
$p = new Page($v['url']);
// grab list of pages
$p->go_line('id="page_select"');
$pages = $p->next_line()->extract_to_array('value="', '"');
// grab current image
$this->crawl_page($p, $ifx);
array_shift($pages);
foreach ($pages as $purl) {
$p = new Page($purl);
$this->crawl_page($p, $ifx);
}
/*
Manga_Crawler::multiProcess(4, $pages, array($this, 'crawl_page'), array($ifx));
*/
}