jaeger/querylist-phantomjs
Composer 安装命令:
composer require jaeger/querylist-phantomjs
包简介
QueryList Plugin: Use PhantomJS to crawl Javascript dynamically rendered pages.(headless WebKit ) 使用PhantomJS采集JavaScript动态渲染的页面
README 文档
README
QueryList Plugin: Use PhantomJS to crawl Javascript dynamically rendered pages.(headless WebKit )
QueryList插件: 使用PhantomJS采集JavaScript动态渲染的页面。
PhantomJS: http://phantomjs.org QueryList:https://github.com/jae-jae/QueryList
Installation for QueryList4
composer require jaeger/querylist-phantomjs
API
- browser($url,$debug = false,$commandOpt = []):Open url in browser ,return QueryList
Installation options
QueryList::use(PhantomJs::class,$opt1,$opt2)
- $opt1: PhantomJS bin path
- $opt2:
browserfunction alias.
Usage
- Installation Plugin
use QL\QueryList; use QL\Ext\PhantomJs; $ql = QueryList::getInstance(); // Set PhantomJS bin path $ql->use(PhantomJs::class,'/usr/local/bin/phantomjs'); //or Custom function name $ql->use(PhantomJs::class,'/usr/local/bin/phantomjs','browser');
- Example-1
$html = $ql->browser('https://m.toutiao.com')->getHtml(); print_r($html); $data = $ql->browser('https://m.toutiao.com')->find('p')->texts(); print_r($data->all()); // Command option see: http://phantomjs.org/api/command-line.html $ql->browser('https://m.toutiao.com',true,[ '--proxy' => '192.168.1.42:8080', '--proxy-type' => 'http' ])
- Example-2
$data = $ql->browser(function (\JonnyW\PhantomJs\Http\RequestInterface $r){ $r->setMethod('GET'); $r->setUrl('https://m.toutiao.com'); $r->setTimeout(10000); // 10 seconds $r->setDelay(3); // 3 seconds return $r; })->find('p')->texts(); print_r($data->all());
- Example-3
$data = $ql->browser(function (\JonnyW\PhantomJs\Http\RequestInterface $r){
$r->setMethod('GET');
$r->setUrl('https://m.toutiao.com');
$r->setTimeout(10000); // 10 seconds
$r->setDelay(3); // 3 seconds
return $r;
},true,[
'--cookies-file' => '/path/to/cookies.txt'
])->rules([
'title' => ['p','text'],
'link' => ['a','href']
])->query()->getData();
print_r($data->all());
jaeger/querylist-phantomjs 适用场景与选型建议
jaeger/querylist-phantomjs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.42k 次下载、GitHub Stars 达 61, 最近一次更新时间为 2017 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jaeger/querylist-phantomjs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaeger/querylist-phantomjs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 24.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 62
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-30