• PHP抖音无水印解析api


    输出标准的格式化了的json格式,ajax直接调用,调用地址/url=抖音地址
    主要内容都输出了,status为1输出成功。
    ps:要网站输出视频必须支持https

    <?php
    $url = @$_GET['url'];
    if (strstr($url,"douyin.com")) {
    //获取301跳转真实地址	
    function getrealurl($url){ $header = get_headers($url,1); 
    if (strpos($header[0],'301') || strpos($header[0],'302')) 
    {if(is_array($header['Location'])) {return $header['Location'][count($header['Location'])-1];
    }else{return $header['Location'];}}else{return $url;}};
    $url = getrealurl($url);
    //模拟苹果手机访问
    $UserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1';
    // 截取ID
    function GetBetween($content,$start,$end) {
    $r = explode($start, $content);
    if (isset($r[1])) {
    $r = explode($end, $r[1]);
    return $r[0];
    }
    return '';
    }
    $b = 'https://www.iesdouyin.com/share/video/';
    $c = '/?';
    $id = GetBetween($url,$b,$c);
    $d ='https://api-hl.amemv.com/aweme/v1/aweme/detail/?aid=1128&app_name=aweme&version_code=251&aweme_id='.$id;
    //curl
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $d);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_ENCODING, '');
    curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($curl);
    $a = $data;
    curl_close($curl);
    header('Content-type:text/json'); 
    $Array = json_decode($a,true);
    $name = $Array["aweme_detail"]["author"]["nickname"];
    $title = $Array["aweme_detail"]["share_info"]["share_title"];
    $videourl= $Array["aweme_detail"]["video"]["play_addr"]["url_list"][0];
    $cover = $Array["aweme_detail"]["video"]["origin_cover"]["url_list"][0];
    $des = $Array["aweme_detail"]["desc"];
    if($videourl==""){
    	$status = "0";
    }else{
    	$status="1";
    }
    $Json = array('status'=>$status,'name'=>$name,'title'=>$title,'des'=>$des,'cover'=>$cover,'videourl'=>$videourl);
    $turl=json_encode($Json,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
    echo stripslashes($turl);
    } else
    {
    echo '请输入抖音分享的地址,如:http://v.douyin.com/eRcTtj/';
    }
    ?>
    
  • 相关阅读:
    sqlmap的学习以及使用
    SQL查询关于相对路径、矢代、绝对路径、递归、计算列的速度对比跟优化-SOD群记录
    新版本打印控件插件
    vs2013 遇到的web性能记录器无法使用问题
    sql数据库 管理处理问题--维护计划
    nopcommerce 初学2
    控制饭庄
    递归问题==优化 还有数据库sqlreader
    Java基础 -3.2
    Java基础 -3
  • 原文地址:https://www.cnblogs.com/L1079991001/p/11178689.html
Copyright © 2020-2023  润新知