抖音无水印解析PHP源码
仅限学习使用
输出为标准的格式化json数据
ajax直接调用即可
原生的ajax的调用 *** 看底部
<?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, *** ON_PRETTY_PRINT| *** ON_UNESCAPED_UNICODE); echo stripslashes($turl); } else { echo '请输入抖音分享的地址,如:http://v.douyin.com/eRcTtj/'; } ?>
<script> function setValue() { var v = document.getElementById("input1").value;//取得参数 var reg=/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/; if(!reg.test(v)){md.showWarning('top','right');} else{ var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","/douyin/?url="+v,false); xmlhttp.send(); document.getElementById("myDiv").innerHTML=xmlhttp.responseText;//获取数据 var jsonObj = *** ON.parse(xmlhttp.responseText); // 初始化!!! //document.getElementById("input1").value= jsonObj.url; //注释解析 document.getElementById("v1").src = jsonObj.url; document.getElementById("media").load(); md.showNotification('top','right');// } } </script>
网站输出视频必须是https协议
这里提供一种临时处理的思路:既然新浪判断了Referer,我们伪造就是了 最后用API方式调用,例如:api.php?url=新浪外链地址 远程图片 <?php/** * @descri...
Emlog今日文章时间加红 只需要写一个判断,那如果今日未发文则显示昨日时间加红怎么实现呢? 首先我们需要判断一下今日是否发文 把代码放到模板下module.php中 &l...
微信域名安全检测API PHP源码 感谢蓝优提供源码 这是一个很简单操作,利用跳转检测是否和域名一致。调用:域名/api.php?url= <?php /** --------...
1要拼接接收的手机号和短信 public function sendcode() { $parpm = input(); $valist = $this-&g...
<?php // 实例1 /** * @start time */ function proStartTime() { global $startTime; $mtime1...
<?php header('Access-Control-Allow-Origin:*'); header('Content-Type:text/json;charset=utf8'); /*...