本文整理汇总了PHP中Page::next_line方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::next_line方法的具体用法?PHP Page::next_line怎么用?PHP Page::next_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::next_line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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";
}
}
示例3: 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);
}
示例4: extract_info
public function extract_info($base)
{
$p = new Page($base);
$p->go_line('<!-- START FILE LOOP -->');
$list = array();
do {
if ($p->curr_line()->contain('href=')) {
$url = $p->curr_line()->cut_between("</td><td><a href='", "'");
$desc = $url->dirname()->dirname()->basename();
$ifx = $desc->substr(-3);
$list[] = array('url' => $url->to_s(), 'desc' => $desc->to_s(), 'infix' => $ifx->to_s());
}
} while (!$p->next_line()->contain('<!-- END DOWNLOADS -->'));
return $list;
}
示例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 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;
}
示例6: extract_info
public function extract_info($base)
{
// crawl chapters
$p = new Page($base);
$p->go_line('class="list"');
$list = array();
do {
if ($p->curr_line()->contain('class="title"') && $p->curr_line()->contain('title=')) {
$line = $p->curr_line()->dup();
$href = $line->dup()->cut_between('href="', '"')->to_s();
$desc = $line->dup()->cut_between('title="', '">')->to_s();
$infix = basename($href);
$list[] = array('url' => $href, 'desc' => $desc, 'infix' => $infix);
}
} while (!$p->next_line()->contain('</article>'));
return $list;
}
示例7: get_info
public function get_info($base)
{
// crawl chapters
$p = new Page($base);
$p->go_line('<table class="table table-striped">');
$list = array();
do {
if ($p->curr_line()->contain('href="')) {
$line = $p->curr_line();
$href = $line->cut_between('href="', '"');
$desc = $line->cut_between('">', '</a');
$infix = $desc->regex_match('/(\\d+)/');
$infix = $infix[1];
$list[] = array('url' => $href->to_s(), 'desc' => $desc->to_s(), 'infix' => $infix);
}
} while (!$p->next_line()->contain('</table>'));
return $list;
}
示例8: 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";
}
}
示例9: get_info
public function get_info($base)
{
$p = new Page($base);
$p->go_line('<div class="divThickBorder" style="padding:7px">');
$raw = $p->next_line()->dup();
$list = array();
foreach (explode('<tr>', $raw->to_s()) as $line) {
$tline = new Text($line);
if ($tline->contain('href="')) {
$href = $tline->dup()->cut_between('href="', '"')->to_s();
$desc = $tline->dup()->cut_between('">', '</a')->to_s();
preg_match('/([\\.\\d]+) :/', $desc, $m);
$infix = $m[1];
$list[] = array('url' => $href, 'desc' => strip_tags($desc), 'infix' => $infix);
}
}
return $list;
}
示例10: 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));
*/
}
示例11: 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);
}
}
示例12: get_images
public function get_images($chapter_url, $prefix, $infix)
{
$ifx = Text::create($infix)->pad(3)->to_s();
$p = new Page($chapter_url, array('become_firefox' => true));
// grab list of pages
$p->go_line('var lstImages');
$i = 1;
$result = array();
do {
if ($p->curr_line()->contain('lstImages.push')) {
$line = $p->curr_line();
$img = $line->cut_between('push("', '")');
$iname = Text::create($i++)->pad(3)->to_s() . Text::create(basename($img))->cut_rfrom('.')->cut_before('?')->to_s();
$name = "{$prefix}-{$ifx}-{$iname}";
$result[$name] = $img;
}
} while (!$p->next_line()->contain('new Array()'));
$pages = $p->curr_line()->extract_to_array('href="', '"');
return $result;
}
示例13: 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;
}
示例14: download_chapters
private function download_chapters($chapters)
{
$prefix = 'Birth_of_Levi';
$dir = '/home/khandar-gdp/tmp/birth of levi/';
foreach ($chapters as $infix => $url) {
echo "Opening {$url}...\n";
$p = new Page($url);
$p->go_line('pages[1]=');
$i = 1;
do {
$line = $p->curr_line();
$img = $line->cut_between('="', '"');
$suffix = Text::create($i++)->pad(3)->to_s();
$ext = $img->cut_rafter('.');
$filename = "{$dir}{$prefix}-{$infix}-{$suffix}.{$ext}";
if (!is_file($filename)) {
download_it($img->to_s(), $filename);
}
} while ($p->next_line()->contain('pages['));
}
}
示例15: grab_volume_chapters
public function grab_volume_chapters()
{
$p = new Page('http://en.wikipedia.org/wiki/List_of_Hajime_no_Ippo_chapters');
$list = array();
while (!$p->end_of_line()) {
$p->go_line('Main article:');
if ($p->end_of_line()) {
break;
}
$href = 'http://en.wikipedia.org' . $p->curr_line()->dup()->cut_between('href="', '"')->to_s();
$p2 = new Page($href);
while (!$p2->end_of_line()) {
try {
$p2->go_line('<td id="vol');
$vol = $p2->curr_line()->dup()->cut_between('">', '<')->to_s();
do {
if ($p2->curr_line()->contain('<li>Round ')) {
$last_chapter = $p2->curr_line()->dup()->cut_between('Round ', ':')->to_s();
}
} while (!$p2->next_line()->contain('</table>'));
$list[$vol] = $last_chapter;
// echo "v $vol c $last_chapter <br/>\n";
} catch (Exception $e) {
break;
}
}
$p->next_line();
}
return $list;
}