wangqs/querylist-rule-iask
Composer 安装命令:
composer require wangqs/querylist-rule-iask
包简介
QueryList Plugin: Iask searcher. QueryList新浪爱问搜索插件
README 文档
README
QueryList Plugin: Iask searcher.
QueryList插件:新浪爱问搜索引擎
Installation for QueryList4
composer require wangqs/querylist-rule-iask
API
- Iask iask($pageNumber = 10):get Iask Searcher.
class Iask:
- Iask search($keyword):set search keyword.
- Iask 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
Usage
- Installation Plugin
use QL\QueryList; use QL\Ext\Baidu; $ql = QueryList::getInstance(); $ql->use(Iask::class); //or Custom function name $ql->use(Iask::class,'iask');
- Example-1
$baidu = $ql->iask(10); $searcher = $baidu->search('什么是快乐星球'); $count = $searcher->getCount(); $data = $searcher->page(1); $data = $searcher->page(2); $searcher = $baidu->search('什么是快乐星球'); $countPage = $searcher->getCountPage(); for ($page = 1; $page <= $countPage; $page++) { $data = $searcher->page($page); }
- Example-2
$searcher = $ql->baidu()->search('什么是快乐星球'); $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('什么是快乐星球'); $data = $searcher->page(1); print_r($data->all()); // Get real url $data = $searcher->page(1,true); print_r($data->all());
Out:
Array
(
[0] => Array
(
[title] => 快乐星球
[link] => https://iask.sina.com.cn/b/3602430.html
)
[1] => Array
(
[title] => 哪里能看快乐星球
[link] => https://iask.sina.com.cn/b/8520162.html
)
[2] => Array
(
[title] => 快乐星球
[link] => https://iask.sina.com.cn/b/5887903.html
)
)
Array
(
[0] => Array
(
[title] => 快乐星球
[link] => https://iask.sina.com.cn/b/3602430.html
)
[1] => Array
(
[title] => 哪里能看快乐星球
[link] => https://iask.sina.com.cn/b/8520162.html
)
[2] => Array
(
[title] => 快乐星球
[link] => https://iask.sina.com.cn/b/5887903.html
)
)
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-25