2017 © Pedro Peláez
 

library querylist-rule-baidu

QueryList Plugin: Baidu searcher. QueryList百度搜索插件

image

jaeger/querylist-rule-baidu

QueryList Plugin: Baidu searcher. QueryList百度搜索插件

  • Monday, October 2, 2017
  • by jae
  • Repository
  • 1 Watchers
  • 1 Stars
  • 311 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 15 % Grown

The README.md

QueryList-Rule-Baidu

QueryList Plugin: Baidu searcher., (*1)

QueryList插件:百度搜索引擎, (*2)

QueryList:https://github.com/jae-jae/QueryList, (*3)

Installation for QueryList4

composer require jaeger/querylist-rule-baidu

API

  • Baidu baidu($pageNumber = 10):get Baidu Searcher.

class Baidu: - Baidu search($keyword):set search keyword. - Baidu setHttpOpt(array $httpOpt = []):Set the http option,see: GuzzleHttp options - int getCount():Get the total number of search results. - int getCountPage():Get the total number of pages. - Collection page($page = 1,$realURL = false):Get search results, (*4)

Usage

  • Installation Plugin
use QL\QueryList;
use QL\Ext\Baidu;

$ql = QueryList::getInstance();
$ql->use(Baidu::class);
//or Custom function name
$ql->use(Baidu::class,'baidu');
  • Example-1
$baidu = $ql->baidu(10)
$searcher = $baidu->search('QueryList');
$count = $searcher->getCount();
$data = $searcher->page(1);
$data = $searcher->page(2);

$searcher = $baidu->search('php');
$countPage = $searcher->getCountPage();
for ($page = 1; $page <= $countPage; $page++)
{
    $data = $searcher->page($page);
}
  • Example-2
$searcher = $ql->baidu()->search('QueryList');
$data = $searcher->setHttpOpt([
    // Set the http proxy
    'proxy' => 'http://222.141.11.17:8118',
   // Set the timeout time in seconds
    'timeout' => 30,
])->page(1);
  • Example-3
$baidu = $ql->baidu(3)
$searcher = $baidu->search('QueryList');

$data = $searcher->page(1);
print_r($data->all());

// Get real url
$data = $searcher->page(1,true);
print_r($data->all());

Out:, (*5)

Array
(
    [0] => Array
        (
            [title] => QueryList|基于phpQuery的无比强大的PHP采集工具
            [link] => http://www.baidu.com/link?url=qRAXrUIcrxuLQ4Pn_rL25HvpDwugxgLkmwB74wTBuLflWaDTNY1d27gdxMwddbfn
        )
    [1] => Array
        (
            [title] => 介绍- QueryList指导文档
            [link] => http://www.baidu.com/link?url=NgoB517LCcb7tt37_x74uF0N-8pfhSemhA5qoB0SHf8HY9P_MwKbN80nf9zvd3V5
        )
    [2] => Array
        (
            [title] => PHP 用QueryList抓取网页内容 - wb145230 - 博客园
            [link] => http://www.baidu.com/link?url=kDkpY9eZ6CsiT1SWomRWEYPauHseHn2FseSdPnsOoulWCkD3DK6QMT75urFGHLyeG_M9yTD0BCm-s5jGQRi_S_
        )

)

Array
(
    [0] => Array
        (
            [title] => QueryList|基于phpQuery的无比强大的PHP采集工具
            [link] => http://www.querylist.cc/
        )
    [1] => Array
        (
            [title] => 介绍- QueryList指导文档
            [link] => http://doc.querylist.cc/
        )
    [2] => Array
        (
            [title] => PHP 用QueryList抓取网页内容 - wb145230 - 博客园
            [link] => http://www.cnblogs.com/wb145230/p/4716403.html
        )
)

The Versions

02/10 2017

dev-master

9999999-dev

QueryList Plugin: Baidu searcher. QueryList百度搜索插件

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jaeger

01/10 2017

4.0.1

4.0.1.0

QueryList Plugin: Baidu searcher. QueryList百度搜索插件

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jaeger

01/10 2017

4.0.0

4.0.0.0

QueryList Plugin: Baidu searcher. QueryList百度搜索插件

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jaeger