yqcode/querylist-ext-phantomjs
Composer 安装命令:
composer require yqcode/querylist-ext-phantomjs
包简介
QueryList V3 Plugin: Use PhantomJS to crawl Javascript dynamically rendered pages.(headless WebKit )
README 文档
README
QueryList V3 Plugin: Use PhantomJS to crawl Javascript dynamically rendered pages.(headless WebKit )
querylist-ext-phantomjs 安装
通过composer安装:
composer require huanyq2008/querylist-ext-phantomjs
querylist-ext-phantomjs 使用
下面演示QueryList用一句代码采集页面信息:
$urlarr = [ 'https://mimvp.com', // 默认 utf-8 'https://www.qq.com', // 默认 gb2312,需添加 header,否则乱码 'https://www.dajie.com', // content在前,name在后,匹配错误(从第一个content开始,从最后一个name结束) 'https://m.toutiao.com', 'https://www.baidu.com', 'https://mp.weixin.qq.com/s/NHD6BXCbJYzl4gK-NYBKaw', ]; //插件调用 $ql = QueryList::run('PhantomJs', [ 'binpath'=>'/usr/bin/phantomjs', 'url'=>$urlarr[0], 'debug'=>false ]); //设置规则 $data = $ql->setQuery(array( 'title' => array('title','text'), 'keywords' => array('meta[name=keywords]','content'), 'description' => array('meta[name=description]','content'), 'img' => array('img','src') ))->data; print_r($data);
上面的代码实现的功能是采集相关页面的标题、关键字、描述和图片,然后分别以二维关联数组的格式输出。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-22