用鼠标与指尖
让互联网更加有趣

原创更新:快手短视频无水印直连解析下载PHP前端版

原创更新:快手短视频无水印直连解析下载PHP前端版-小伟博客

最近老铁们都在找快手短视频无水印解析的方法,所以无聊自己写了个PHP的前端脚本,仅供参考学习,请勿用于商业用途!

整个思路就是获取分享链接302跳转后url的源码取出视频链接和相关信息就行了
以下是PHP完整代码(请自行套前端css样式):

<?php
$url = @$_GET['url'];
$url = head($url);
$urlid = GetBetween($url,'https://live.kuaishou.com/u/','?fid');
$urlid = GetBetween($urlid,'/','/');

$datas = get($url);
$data = GetBetween($datas,$urlid,'false}');

$id = GetBetween($data,'newWatermark\u002F','.');
$surl = 'https://txmov2.a.yximgs.com/bs2/newWatermark/'.$id.'.mp4';

$name = GetBetween($data,'jpg","name":"','"');

$txt = GetBetween($data,'caption":"','"');

$namejpg = GetBetween($datas,'profile":"https:', '"');
$namejpg = unicodeDecode($namejpg);
$namejpg = 'https:'.$namejpg;

$videoimg = GetBetween($data,'thumbnailUrl":"', '"');
$videoimg = unicodeDecode($videoimg);

if (strstr($url,"kuaishou.com")) {
echo '
<div class="shuchu">
(长时间没有反应,请刷新页面或重新输入地址)<br>
解析结果:<br><HR>
分享用户:'.$name.'<HR>
<img src="'.$namejpg.'" height="200" width="200"/><HR>
分享说明:'. $txt.'<HR>';
$time = date('YmdHis');
echo '
视频地址: <textarea readonly="readonly" cols="100%" rows="1" id="biao1"style="color:#666;background-color: #ffffff00;text-align: center;margin-top: 10px;">'.$surl.'</textarea>
<a href="'.$surl.'"target="_blank"style=" color:#666;">播放</a>
<a href="'.$surl.'"target="_blank"style=" color:#666;"download="快手_'.$name.'_'.$time.'">下载</a>
<a href="javascript:void(0);" onclick="copyUrl2();"style=" color:#666;">复制链接</a><br>
<hr>在线播放:<hr>
<div style="text-align: center;">
<video id="video_img" poster="'.$videoimg.'" controls="controls" >
<source id="video_src" src="'.$surl.'" type="video/mp4">
</video>
</div>
<HR>
</div>';
} else
{
echo '<div class="shuchu">请输入快手分享的地址,如:http://www.gifshow.com/s/s8FmE7gO';
//echo '<script type="text/javascript">alert("请输入快手分享的地址,如:http://www.gifshow.com/s/s8FmE7gO");</script>';
}

function head($url){
$header = get_headers($url,1);
if (strpos($header[0],'301') || strpos($header[0],'302')) {
if(is_array($header['Location'])) {
$info = $header['Location'][count($header['Location'])-1]; 
}else{
$info = $header['Location'];
}
}
return $info;
}
function GetBetween($content,$start,$end) {
$r = explode($start, $content);
if (isset($r[1])) {
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}

function unicodeDecode($name) {
$json = '{"str":"'.$name.'"}';
$arr = json_decode($json,true);
if (empty($arr)) return '';
return $arr['str'];
}
function get($url) {
$user_agent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_URL, $url);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
?>
支付宝扫码打赏 微信扫码打赏

如果文章对你有帮助,欢迎点击上方按钮打赏作者

未经允许不得转载:小伟博客 » 原创更新:快手短视频无水印直连解析下载PHP前端版

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

小伟博客 · 给你感兴趣的内容

联系我们官方交流群