本文整理汇总了PHP中Page::curr_line方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::curr_line方法的具体用法?PHP Page::curr_line怎么用?PHP Page::curr_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::curr_line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: extract_info
public function extract_info($base)
{
// crawl chapters
$p = new Page($base);
$p->go_line('h3 class="maintitle"');
// print_r($p);exit;//debug
$list = array();
do {
if ($p->curr_line()->contain('book_open.png')) {
$line = $p->curr_line()->dup();
$href = $line->dup()->cut_between('href="', '"')->to_s();
$desc = $line->dup()->cut_between('/>', '</a')->to_s();
preg_match('/h\\.(\\d+):?/', $desc, $m);
$infix = $m[1];
preg_match('/_by_(.*)$/', $href, $m);
$group = $m[1];
// cek bahasa
$lang = $p->next_line(2);
if ($lang->contain('English')) {
$list[] = array('url' => $href, 'desc' => $desc . ' by ' . $group, 'infix' => $infix);
}
}
} while (!$p->next_line()->contain('</table>'));
return $list;
}
示例3: 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;
}
示例4: 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];
}
示例5: 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);
}
示例6: 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";
}
}
示例7: 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;
}
示例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_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;
}
示例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: 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);
}
}
示例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 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;
}
示例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="cmbpages"');
$pages = $p->curr_line()->extract_to_array('value="', '"');
// grab current image
$result = $this->crawl_page($p, $prefix, $ifx);
array_shift($pages);
// grab the rest of pages
foreach ($pages as $i => $page) {
$p = new Page($chapter_url . '/page_' . $page);
$result = $result + $this->crawl_page($p, $prefix, $ifx);
}
return $result;
}
示例15: crawl_chapter
public function crawl_chapter($v)
{
$ifx = Text::create($v['infix'])->pad(3)->to_s();
$p = new Page($v['url']);
$p->go_line('var pages');
$json = $p->curr_line()->cut_between(' = ', ';');
$list = json_decode($json);
foreach ($list as $page) {
$purl = new Text($page->url);
$name = new Text($page->filename);
if ($name->strlen() < 15) {
$name = $this->prefix . '-' . $ifx . '-' . $name;
}
if ($purl->contain('resize_img.php')) {
$purl = $purl->cut_between('resize_img.php?url=', '&width');
}
echo "<a href='{$purl}'>{$name}</a><br/>\n";
}
}