天天看點

一個可以去水印的解析接口

這是

public function douyin($url){

l o c = g e t h e a d e r s ( loc = get_headers( loc=geth​eaders(url, true)[‘location’];

preg_match(’/video/(.)//’, l o c , loc, loc,id);

a r r = j s o n d e c o d e ( arr = json_decode( arr=jsond​ecode(this->curl(‘https://短視訊網址/web/api/v2/aweme/iteminfo/?item_ids=’.$id[1]), true);

preg_match(’/href="(.?)" target="_blank" rel="external nofollow" >Found/’, $this->curl(str_replace( ‘play’, $arr[‘item_list’][0][“video”][“play_addr”][“url_list”][0])), $matches);

$video_url = str_replace(’&’, ‘&’, m a t c h e s [ 1 ] ) ; i f ( ! e m p t y ( matches[1]); if (!empty( matches[1]);if(!empty(video_url)){

$arr = array(

‘code’ => 200,

‘msg’ => ‘解析成功’,

‘data’ => array(

‘author’ => $arr[‘item_list’][0][‘author’][‘nickname’],

‘uid’ => $arr[‘item_list’][0][‘author’][‘unique_id’],

‘avatar’ => $arr[‘item_list’][0][‘author’][‘avatar_larger’][‘url_list’][0],

‘like’ => $arr[‘item_list’][0][‘statistics’][‘digg_count’],

‘time’ => $arr[‘item_list’][0][“create_time”],

‘title’ => $arr[‘item_list’][0][‘share_info’][‘share_title’],

‘cover’ => $arr[‘item_list’][0][‘video’][‘origin_cover’][‘url_list’][0],

‘url’ => $video_url,

‘music’ => array(

‘author’ => $arr[‘item_list’][0][‘music’][‘author’],

‘avatar’ => $arr[‘item_list’][0][‘music’][‘cover_large’][‘url_list’][0],

‘url’ => $arr[‘item_list’][0][‘music’][‘play_url’][‘url_list’][0],

)

)

);

return $arr;

}

}