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

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

原创更新:抖音短视频无水印直连解析下载PHP前端版-彩神app网址

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

首先我们要用$_GET方式接收抖音的分享链接:

$url = @$_GET['url']; //建议用GET方式,原理自行百度。

然后我们要解析抖音分享链接的html源码
然后我们用常用的curl的方式来访问抖音的分享链接获取源码:

$UserAgent = '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)';
//加UA那是必须的
$curl = curl_init();
//创建一个新的CURL资源
curl_setopt($curl, CURLOPT_URL, $url);
//设置URL和相应的选项
curl_setopt($curl, CURLOPT_HEADER, 0);
//0表示不输出Header,1表示输出
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//设定是否显示头信息,1显示,0不显示。
//如果成功只将结果返回,不自动输出任何内容。如果失败返回FALSE

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_ENCODING, '');
//设置编码格式,为空表示支持所有格式的编码
//header中“Accept-Encoding: ”部分的内容,支持的编码格式为:"identity","deflate","gzip"。

curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
//设置这个选项为一个非零值(象 “Location: “)的头,服务器会把它当做HTTP头的一部分发送(注意这是递归的,PHP将发送形如 “Location: “的头)。
$data = curl_exec($curl);
//获取的源码
//echo $data;
curl_close($curl);
//关闭cURL资源,并释放系统资源

然后我们根据html源码取出短视频相关信息:

//取出播放链接
$a = $data;
$b = "playAddr: \"";
$c = "\"";
$s = GetBetween($a,$b,$c);
function GetBetween($content,$start,$end) {
$r = explode($start, $content);
if (isset($r[1])) {
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
$surl = str_replace("playwm",'play' ,$s);//去水印的关键所在,删出url中的wm就行了

$b = '<p class="name nowrap">';
$c = '</p>';
$name = GetBetween($a,$b,$c);//取出作者昵称

function unicodeDecode($name) {
$json = '{"str":"'.$name.'"}';
$arr = json_decode($json,true);
if (empty($arr)) return '';
return $arr['str'];
}
$name = unicodeDecode($name);//作者昵称转码

$b = "desc\">";
$c = "<";
$txt = GetBetween($a,$b,$c);//取出说明文字
$txt = unicodeDecode($txt);//说明文字转码

$b = "/aweme/100x100/";
$c = "\"";
$namejpg = GetBetween($a,$b,$c);
$namejpg = 'https://p3.pstatp.com/aweme/200x200/'.$namejpg;//取出作者头像

最后输出解析的相关信息:

//输出前端解析内容
//判断是否是抖音的链接
if (strstr($url,"douyin.com")) {
echo ""."分享用户:".$name."<HR></br>";
echo ""."<img src=\"".$namejpg."\" \"height=\"200\" width=\"200\"/><HR></br>";
echo ""."分享说明:". " ". $txt. "<HR></br>";
$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> ';
} else
{
echo '请输入抖音分享的地址,如:http://v.douyin.com/eRcTtj/';
}

整个思路就是获取抖音分享链接的源码取出视频链接去除水印就行了
PHP完整代码:

<?php
$url = @$_GET['url'];
$UserAgent = '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)';
$curl = curl_init();
//创建一个新的CURL资源
curl_setopt($curl, CURLOPT_URL, $url);
//设置URL和相应的选项
curl_setopt($curl, CURLOPT_HEADER, 0);
//0表示不输出Header,1表示输出
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//设定是否显示头信息,1显示,0不显示。
//如果成功只将结果返回,不自动输出任何内容。如果失败返回FALSE

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_ENCODING, '');
//设置编码格式,为空表示支持所有格式的编码
//header中“Accept-Encoding: ”部分的内容,支持的编码格式为:"identity","deflate","gzip"。

curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
//设置这个选项为一个非零值(象 “Location: “)的头,服务器会把它当做HTTP头的一部分发送(注意这是递归的,PHP将发送形如 “Location: “的头)。

$data = curl_exec($curl);
//echo $data;

curl_close($curl);
//关闭cURL资源,并释放系统资源
//取出播放链接
$a = $data;
$b = "playAddr: \"";
$c = "\"";
$s = GetBetween($a,$b,$c);
function GetBetween($content,$start,$end) {
$r = explode($start, $content);
if (isset($r[1])) {
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
$surl = str_replace("playwm",'play' ,$s);
//去水印的关键所在,删出url中的wm就行了

$b = '<p class="name nowrap">';
$c = '</p>';
$name = GetBetween($a,$b,$c);
//取出作者昵称

function unicodeDecode($name) {
$json = '{"str":"'.$name.'"}';
$arr = json_decode($json,true);
if (empty($arr)) return '';
return $arr['str'];
}
$name = unicodeDecode($name);
//作者昵称转码

$b = "desc\">";
$c = "<";
$txt = GetBetween($a,$b,$c);
//取出说明文字
$txt = unicodeDecode($txt);
//说明文字转码

$b = "/aweme/100x100/";
$c = "\"";
$namejpg = GetBetween($a,$b,$c);
$namejpg = 'https://p3.pstatp.com/aweme/200x200/'.$namejpg;
//取出作者头像

//输出前端解析内容
//判断是否是抖音的链接
if (strstr($url,"douyin.com")) {
echo "<div style=\"text-align: center;\">分享用户:".$name."<HR></br>";
echo "<img src=\"".$namejpg."\" \"height=\"200\" width=\"200\"/><HR></br>";
echo "分享说明: ". $txt. "<HR></br>";
$time = date('YmdHis');
//取当前时间
echo '视频地址: <textarea readonly="readonly" id="biao1"cols="100%" rows="1" 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></div>
<script type="text/javascript">
function copyUrl2() {
var Url2 = document.getElementById("biao1");
Url2.select();
document.execCommand("Copy");
alert("已复制好,可贴粘。");
}
</script>';
} else
{
echo '请输入抖音分享的地址,如:http://v.douyin.com/eRcTtj/';
}
?>

以上代码新建保存到php utf-8编码然后 域名/php文件名?url=抖音分享链接

例如:https://api.mlwei.com/dy/douyin.php?url=http://v.douyin.com/eRcTtj/

原创更新:抖音短视频无水印直连解析下载PHP前端版-彩神app网址

支付宝扫码打赏 微信扫码打赏

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

未经允许不得转载:彩神app网址 » 原创更新:抖音短视频无水印直连解析下载PHP前端版

分享到:更多 ()

评论 10

  1. #10

    我没有意识到的是,如果真相被告知你如何不再比现在更加明智。 你太聪明了
    因此,你知道与此事有很大关系,因此我认为从很多不同角度来看都是如此。 就像女性和男性似乎没有参与其中,除了它是女孩加加要完成的事情! 你个人的东西很棒。 在任何时候都要照顾好它!

  2. #9
  3. #8

    换个接口就可以了。妥妥的

    蓝优10个月前 (12-06)Reply
  4. #7

    失效了!!大佬

    月灵博客12个月前 (10-06)Reply
  5. #6

    Thanks for this article. I’d also like to express that it can often be hard if you are in school and simply starting out to initiate a long credit standing. There are many students who are just trying to endure and have an extended or favourable credit history are often a difficult matter to have. dekegcbdegbc

    Johnk3531年前 (2018-08-19)Reply
  6. #5

    When I originally commented I clicked the Notify me when new comments are added checkbox and now every time a comment is added I get 4 emails using the same comment. Is there any way you may take away me from that service? Thanks! fedkcakfbkdc

    Johnf6081年前 (2018-08-19)Reply
  7. #4

    Hello there! This post could not be written any better! Reading this post reminds me of my good old room mate! He always kept talking about this. I will forward this page to him. Fairly certain he will have a good read. Thank you for sharing! efbfaeeebdee

    Johne1971年前 (2018-08-18)Reply
  8. #3

    Hello,
    Downloads Mp3 Scene Music Private FTP

    http://0daymusic.org

    Private FTP MP3/FLAC 1990-2018:

    Plan A: 20€ – 200GB – 30 Days
    Plan B: 45€ – 600GB – 90 Days
    Plan C: 80€ – 1500GB – 180 Days

    Updated: 2018-07-03 FTP list txt

    Best regards,
    Mark

    TerryGam1年前 (2018-08-03)Reply
  9. #2

    到你的博客走一趟,如同阳光洒在我脸上,心里暖洋洋!

    罗拉套图网1年前 (2018-08-02)Reply
  10. #1

    不错不错,赞一个👍

    IT技术宅1年前 (2018-08-01)Reply

彩神app网址 · 给你感兴趣的内容

联系我们官方交流群