我的博客传送门(https://lzz1.top)查看效果
<?php
/**
* Created by PhpStorm.
* User: Lzz
* Date: 2019/2/28
* Time: 10:03
*/
class Haokan {
# 配置
protected $option = [
'url' => 'https://sv.baidu.com/',
'header' => [
'referer: https://sv.baidu.com/',
'user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'
],
];
# dom
protected $xp;
# 分类
protected $fenlei=[];
# 获取到的视频链接
protected $vsrc=[];
public function __construct($option=[])
{
$this->option = array_merge($this->option,$option);
}
# 获取分类
public function get_fenlei(){
$list = $this->c_dom($this->option['url'])->xp->query('//div[@class="video-tabs-wrapper"]/ul/li/a');
for($i=0;$i<$list->length;$i++){
array_push($this->fenlei,[