src/curlient/crawler/PageCrawler.php
private function getNextPageURL($content, $cfg, $url) {
		static $pages = false, $i = 0;
		if ($pages !== false) {//全部列出模式时使用
			return isset($pages[ $i ]) ? $pages[ $i++ ] : '';
		}

		$link = '';
		if (isset($cfg['pager']) && $cfg['pager']) {
			$pager = $cfg['pager'];
			$type  = isset($pager['type']) ? $pager['type'] : 'list';
			if (is_string($content) && isset($pager['wrapper'])) {
				list($start, $end) = $pager['wrapper'];
				$content = StringFilter::sub($content, $start, $end);
			}
			if (isset($cfg['json'])) {
				$link = $this->getPages(new JsonFilter(), $pager, $content, $pages, $type, $i, $url);
			} else if (isset($cfg['dom'])) {
				$link = $this->getPages(new QueryFilter(), $pager, $content, $pages, $type, $i, $url);
			} else {//从正文取分页
				$filterCfg = $pager['pages'];
				$filter    = new ConcatFilter();
				if ($type == 'list') {
					$filterCfg[] = true;//匹配全部
					$links       = $filter->filter($content, $filterCfg);
					if ($links) {
						$pages = [];
						foreach ($links as $link) {
							$tlink[0]['url'] = $link[0];
							Curlient::goodURL($url, $tlink);
							$tu = $tlink[0]['url'];
							if ($tu != $url && !in_array($tu, $pages)) {
								$pages[] = $tu;
							}
						}
						$link = $pages[ $i++ ];
					}
				} else {//下一页模式
					$link = $filter->filter($content, $filterCfg);
					if ($link) {//取到分页
						$tlink[0]['url'] = $link;
						Curlient::goodURL($url, $tlink);
						if ($tlink[0]['url'] != $url) {
							$link = $tlink[0]['url'];
						} else {
							$link = '';
						}
					}
				}
			}
		}

		return $link;
	}
private function getNextPageURL($content, $cfg, $url) {
		static $pages = false, $i = 0;
		if ($pages !== false) {//全部列出模式时使用
			return isset($pages[ $i ]) ? $pages[ $i++ ] : '';
		}

		$link = '';
		if (isset($cfg['pager']) && $cfg['pager']) {
			$pager = $cfg['pager'];
			$type  = isset($pager['type']) ? $pager['type'] : 'list';
			if (is_string($content) && isset($pager['wrapper'])) {
				list($start, $end) = $pager['wrapper'];
				$content = StringFilter::sub($content, $start, $end);
			}
			if (isset($cfg['json'])) {
				$link = $this->getPages(new JsonFilter(), $pager, $content, $pages, $type, $i, $url);
			} else if (isset($cfg['dom'])) {
				$link = $this->getPages(new QueryFilter(), $pager, $content, $pages, $type, $i, $url);
			} else {//从正文取分页
				$filterCfg = $pager['pages'];
				$filter    = new ConcatFilter();
				if ($type == 'list') {
					$filterCfg[] = true;//匹配全部
					$links       = $filter->filter($content, $filterCfg);
					if ($links) {
						$pages = [];
						foreach ($links as $link) {
							$tlink[0]['url'] = $link[0];
							Curlient::goodURL($url, $tlink);
							$tu = $tlink[0]['url'];
							if ($tu != $url && !in_array($tu, $pages)) {
								$pages[] = $tu;
							}
						}
						$link = $pages[ $i++ ];
					}
				} else {//下一页模式
					$link = $filter->filter($content, $filterCfg);
					if ($link) {//取到分页
						$tlink[0]['url'] = $link;
						Curlient::goodURL($url, $tlink);
						if ($tlink[0]['url'] != $url) {
							$link = $tlink[0]['url'];
						} else {
							$link = '';
						}
					}
				}
			}
		}

		return $link;
	}
取下一页链接

@param array|string $content
@param array        $cfg
@param string       $url

@return array|mixed|string