php抖音背景音乐解析下载API接口,可在线解析下载抖音背景BGM音乐。
API接口代码
<?php $url = empty($_GET['url'])?"https://v.douyin.com/JeRfPdL/":$_GET['url']; header('Content-type: application/json; charset=utf-8'); $body = get_curl($url,0,"https://v.douyin.com",0,1,0,1); preg_match("/Location: (.*?)rn/iU", $body, $urls); if(!$urls[1]){ exit("error"); } $dyurl = $urls[1]; preg_match("/video/(.*?)//s",$dyurl,$item_ids); if(!$item_ids[1]){ exit(json_encode(['code'=>-1,'msg'=>'解析链接失败'],320)); } $item_ids = $item_ids[1]; $api = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=".$item_ids; $boby = get_curl($api); $json = json_decode($boby); $item_list = $json->item_list[0]; if(!$item_list){ exit(json_encode(['code'=>-1,'msg'=>'获取详细信息失败'],320)); } //获取作者信息 $author = $item_list->author; $nickname = $author->nickname;//获取抖音昵称 $unique_id = $author->unique_id;//获取抖音号 $author_tx = $author->avatar_larger->url_list[0];//获取作者高清头像 //获取视频介绍 $desc = $item_list->desc; //获取视频背景音乐 $music = $item_list->music; $music_url = $music->play_url->uri; $return=[ 'code'=>1, 'nickname'=>$nickname, 'unique_id'=>$unique_id, 'desc'=>$desc, 'author_tx'=>$author_tx, 'music_url'=>$music_url, ]; exit(json_encode($return,320)); function get_curl($url,$post=0,$referer=0,$cookie=0,$header=0,$ua=0,$nobaody=0,$split=0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $httpheader[] = "Accept:*/*"; $httpheader[] = "Accept-Encoding:gzip,deflate,sdch"; $httpheader[] = "Accept-Language:zh-CN,zh;q=0.8"; $httpheader[] = "Connection:close"; curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); if($post){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } if($header){ curl_setopt($ch, CURLOPT_HEADER, TRUE); } if($cookie){ curl_setopt($ch, CURLOPT_COOKIE, $cookie); } if($referer){ curl_setopt($ch, CURLOPT_REFERER, $referer); } if($ua){ curl_setopt($ch, CURLOPT_USERAGENT,$ua); }else{ curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36'); } if($nobaody){ curl_setopt($ch, CURLOPT_NOBODY,1); } curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); $ret = curl_exec($ch); if ($split) { $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($ret, 0, $headerSize); $body = substr($ret, $headerSize); $ret=array(); $ret['header']=$header; $ret['body']=$body; } curl_close($ch); return $ret; }
抖音
2022-03-01 1683抖音是目前最火的短视频平台,作为互联网行业的er们当然不能掉队,我的站长站为您整理收集了关于抖音相关的学习资源,包含抖音培训教程,抖音营销软件下载和搬运工必...
- 免登录H5快手商城/抖音小店运营版源码 [2024-10-13]
- 抖音无水印解析PHP接口代码分享 [2024-09-23]
- BlueCatKoKo抖音短视频下载工具V1.1.6,无须获取cookie [2024-09-11]
- 抖音短视频无水印一键批量下载神器 [2024-01-20]
- thinkphp抖音短视频矩阵云混剪营销系统源码V2.2.1免授权版 [2024-01-10]