getdyvideo.php

<?php

error_reporting( E_ALL&~E_NOTICE );
$url = htmlspecialchars($_GET['url']);
$res = http_get($url);
preg_match('/href="(.*?)">Found/', $res, $matches);
$temp=str_replace('&', '&', $matches[1]);
preg_match('/(?<=video\/).*(?=\/\?region)/', $temp, $matches);
$arr = json_decode(http_get('https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='. $matches[0]), true);
preg_match('/href="(.*?)">Found/', http_get(str_replace('playwm', 'play', $arr['item_list'][0]["video"]["play_addr"]["url_list"][0])), $matches);
$videoUrl = str_replace('&', '&', $matches[1]);

if (!empty($videoUrl)) {
	header("Content-type: video/mp4");
	$movie = file_get_contents($videoUrl);
	echo $movie;
}else{
	header("Content-type: text/html");
	echo "参数不正确";
}

 
function http_get($url)
{
    $Header=array( "User-Agent: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");
    $con=curl_init((string)$url);
    curl_setopt($con,CURLOPT_HEADER,False);
    curl_setopt($con,CURLOPT_SSL_VERIFYPEER,False);
    curl_setopt($con,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($con,CURLOPT_HTTPHEADER,$Header);
    curl_setopt($con,CURLOPT_TIMEOUT,5000);

    $result = curl_exec($con);

    return $result;
}
?>

index.html

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<title></title>
</head>
<body>
<form action="getdyvideo.php" method="get">
	<input type="text" name="url">
	<button type="submit">go</button>
	<button type="reset">reset</button>
</form>
</body>
</html>

演示:https://file.jfz.xyz/getdyvideo/