您的位置 首页 > 源码程序 > php

X音短视频 原视频解析 PHP源码

源代码为网络下载的,不过失效了。修复了一下,最新可以使用

  原本在网上搜索到源码很开心!!!

  不过下载下来,使用后发现 根本无法使用 由于改变了方法,经过一番研究 搞定了!!

  可以解析出不带水印的视频地址 视频封面 视频的标题

  以下是所有源码

<?php
$url = @$_GET['url'];
if (strstr($url,"douyin.com")) {
$header=get_headers($url, 1);
$url=$header[location];
$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';
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://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='.$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);
$cover = $Array["item_list"][0]["video"]["origin_cover"]["url_list"][0];
$des = $Array["item_list"][0]["desc"];
$videourl= $Array["item_list"][0]["video"]["play_addr"]["url_list"][0];
$videourl=str_replace("playwm","play",$videourl);
$urlvideo = $videourl;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlvideo);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent);
$contents = curl_exec($ch);
curl_close($ch);
$videourl= GetBetween($contents,'<a href="','">Found</a>.').'.mp4';
if($des==""){
$status = "解析失败";
}else{
$status="解析成功";
}
$Json = array('status'=>$status,'des'=>$des,'cover'=>$cover,'videourl'=>$videourl);
$turl=json_encode($Json,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
echo stripslashes($turl);
} else
{
echo '请输入X音分享的地址,如:http://v.douyin.com/eRcTtj/';
}
?>

  上传到自己的服务器即可使用 或者使用 本站免费的API地址

  http://www.212134.cn/douyin/dy.php?url="X音分享的地址"

本文来自网络,不代表大媒体立场,转载请注明出处。
返回顶部