吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2691|回复: 54
收起左侧

[其他原创] D音无水印解析PHP版

  [复制链接]
小奥 发表于 2024-9-8 15:34
视频地址V3开头才能播放出现V26开头播放不了
重新访问下http://localhost/?url=https://v.douyin.com/ihWf6mpq/就好了


1.png 2.png
[PHP] 纯文本查看 复制代码
<?php

//抖音无水印PHP版
//调用示例  http://localhost/?url=https://v.douyin.com/ihWf6mpq/
error_reporting(0);
$headers = get_redirect_url($_GET["url"]);
preg_match('|video/(.*?)/|',$headers, $a);
$targetUrl = 'https://www.douyin.com/user/self?modal_id='.$a[1].'&showTab=like';
$customUserAgent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36';
$result = fetchDataWithCustomUA($targetUrl, $customUserAgent);
preg_match('|<script id="RENDER_DATA" type="application/json">(.*?)</script>|',$result, $matches);
$middle_text = $matches[1];
$m =json_decode(Urldecode($middle_text));
$arr = array('名字' => $m->app->videoDetail->shareInfo->shareLinkDesc, '封面' =>"https:".$m->app->videoDetail->video->originCover, '视频' =>"https:".$m->app->videoDetail->video->playAddr[0]->src, 'MP3' =>$m->app->videoDetail->music->playUrl->uri);
echo stripslashes(json_encode($arr,JSON_UNESCAPED_UNICODE));
  
function fetchDataWithCustomUA($url, $customUA) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_USERAGENT, $customUA);
	curl_setopt ($ch, CURLOPT_COOKIE , 'ttwid=1%7CP3XfP8WLdGrhhniqvZgITdxee4ylTHNIAFxiA8uiudk%7C1692861969%7Ccbc1e8cb639b9f2537017019cf2e16034eb5e02f91317cf02da669c3d9035225; douyin.com; device_web_cpu_core=8; device_web_memory_size=8; webcast_local_quality=null; strategyABtestKey=%221692861971.054%22; passport_csrf_token=52d1b9f0bdc601061b35649f820990a7; passport_csrf_token_default=52d1b9f0bdc601061b35649f820990a7; FORCE_LOGIN=%7B%22videoConsumedRemainSeconds%22%3A180%7D; s_v_web_id=verify_lloub543_MIbxaeCL_vWX9_4eQ5_B6rZ_XiLUd8TiC2z5; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Afalse%2C%22volume%22%3A0.5%7D; csrf_session_id=b3e96aad3d33a588099da1957c61412b; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCR1QzbVlJN1JlQ1pHYjRyMUxyREJMNWVqVHA5SWJxdjFPZHdsK08rNWFsRFY2dzFFSWZTVEpUbGppeE9GMW9ZK05ubFExbzIwU1Y4UWtUd3gxYUo3aUE9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoxfQ==; ttcid=6e2c49249e684b31adc93ec9d811921d35; pwa2=%220%7C0%7C2%7C0%22; __ac_nonce=064e715db00dce12044ad; __ac_signature=_02B4Z6wo00f01JFEgwQAAIDBX8zLRARkI5yRZIeAAEC64rwojdCoEppcamcP.zNDFFTvK-IdW9t65-J9QZ6AQspB6MmaGXcO2csLGYi13EYeG3xUA6EfUKHORVbG8tX9TWqmvF-XXQJq1BC37e; tt_scid=0RB0BQpAJZCtDUGQEfvGfovmjxWL4NUYr7faECJEqAxGXeNJ7oGESHkuMx8zXBOuf02f; download_guide=%223%2F20230824%2F0%22; IsDouyinActive=true; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A1920%2C%5C%22screen_height%5C%22%3A1080%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A8%2C%5C%22device_memory%5C%22%3A8%2C%5C%22downlink%5C%22%3A5.95%2C%5C%22effective_type%5C%22%3A%5C%224g%5C%22%2C%5C%22round_trip_time%5C%22%3A50%7D%22; VIDEO_FILTER_MEMO_SELECT=%7B%22expireTime%22%3A1693470886177%2C%22type%22%3Anull%7D; home_can_add_dy_2_desktop=%221%22; msToken=phFAWMM1fxkFc4oj6QE8_DMbU57I87HDv_NnoZ9uVNGkx1j9HDT-ddGbno81zAHZuXDF4OKjA1mHIchWdQYixYfFkSCi1Kb-1dKKjmHw_yz-YTa2wQ==; msToken=f_v0fvPvEDKoOBgIkJwOciMoWbigmQ0oZzhY2RgQfO2Otc1zIwtEkRE_kmn8FYYdXDQjAa0tfamm7kXHYD_1M3VrLvLvfQaIP2XtKctXHG4WNcKRyw==; xgplayer_user_id=180566107648');
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
function get_redirect_url($url){
$header = get_headers($url, 1);
if (strpos($header[0], '301') !== false || strpos($header[0], '302') !== false) {
if(is_array($header['Location'])) {
return $header['Location'][count($header['Location'])-1];
}else{
return $header['Location'];
}
}else {
return $url;
}
}
?>

免费评分

参与人数 10吾爱币 +16 热心值 +9 收起 理由
吾恋兮不知 + 1 热心回复!
uusana + 1 + 1 谢谢@Thanks!
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
grrr_zhao + 1 + 1 谢谢@Thanks!
AuroraVerses + 1 + 1 谢谢@Thanks!
jwj + 1 + 1 谢谢@Thanks!
qiaoyong + 1 + 1 热心回复!
Fchua + 1 + 1 很不错的工具
wanfon + 1 + 1 热心回复!
wangxd + 1 + 1 我很赞同!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| 小奥 发表于 2024-9-8 16:15
加了判断   不会出现v26
[PHP] 纯文本查看 复制代码
<?php
error_reporting(0);
$headers = get_redirect_url($_GET["url"]);
preg_match('|video/(.*?)/|',$headers, $a);
$targetUrl = 'https://www.douyin.com/user/self?modal_id='.$a[1].'&showTab=like';
$customUserAgent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36';
$result = fetchDataWithCustomUA($targetUrl, $customUserAgent);
preg_match('|<script id="RENDER_DATA" type="application/json">(.*?)</script>|',$result, $matches);
$middle_text = $matches[1];
$m =json_decode(Urldecode($middle_text));
 preg_match('|v(.*?)-web.douyinvod.com|',$m->app->videoDetail->video->playAddr[0]->src, $dz);
     if ($dz[1]=="26") {
        $idz="https:".$m->app->videoDetail->video->playAddr[1]->src;
    } else {
        $idz="https:".$m->app->videoDetail->video->playAddr[0]->src;
    }
$arr = array('名字' => $m->app->videoDetail->shareInfo->shareLinkDesc, '封面' =>"https:".$m->app->videoDetail->video->originCover, '视频' =>$idz, 'MP3' =>$m->app->videoDetail->music->playUrl->uri);
  
   echo stripslashes(json_encode($arr,JSON_UNESCAPED_UNICODE));


 preg_match('|v(.*?)-web.douyinvod.com|',$m->app->videoDetail->video->playAddr[0]->src, $dz);
     if ($dz[1]=="26") {
        $idz="https:".$m->app->videoDetail->video->playAddr[1]->src;
    } else {
        $idz="https:".$m->app->videoDetail->video->playAddr[0]->src;
    }


   function fetchDataWithCustomUA($url, $customUA) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_USERAGENT, $customUA);
	curl_setopt ($ch, CURLOPT_COOKIE , 'ttwid=1%7CP3XfP8WLdGrhhniqvZgITdxee4ylTHNIAFxiA8uiudk%7C1692861969%7Ccbc1e8cb639b9f2537017019cf2e16034eb5e02f91317cf02da669c3d9035225; douyin.com; device_web_cpu_core=8; device_web_memory_size=8; webcast_local_quality=null; strategyABtestKey=%221692861971.054%22; passport_csrf_token=52d1b9f0bdc601061b35649f820990a7; passport_csrf_token_default=52d1b9f0bdc601061b35649f820990a7; FORCE_LOGIN=%7B%22videoConsumedRemainSeconds%22%3A180%7D; s_v_web_id=verify_lloub543_MIbxaeCL_vWX9_4eQ5_B6rZ_XiLUd8TiC2z5; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Afalse%2C%22volume%22%3A0.5%7D; csrf_session_id=b3e96aad3d33a588099da1957c61412b; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCR1QzbVlJN1JlQ1pHYjRyMUxyREJMNWVqVHA5SWJxdjFPZHdsK08rNWFsRFY2dzFFSWZTVEpUbGppeE9GMW9ZK05ubFExbzIwU1Y4UWtUd3gxYUo3aUE9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoxfQ==; ttcid=6e2c49249e684b31adc93ec9d811921d35; pwa2=%220%7C0%7C2%7C0%22; __ac_nonce=064e715db00dce12044ad; __ac_signature=_02B4Z6wo00f01JFEgwQAAIDBX8zLRARkI5yRZIeAAEC64rwojdCoEppcamcP.zNDFFTvK-IdW9t65-J9QZ6AQspB6MmaGXcO2csLGYi13EYeG3xUA6EfUKHORVbG8tX9TWqmvF-XXQJq1BC37e; tt_scid=0RB0BQpAJZCtDUGQEfvGfovmjxWL4NUYr7faECJEqAxGXeNJ7oGESHkuMx8zXBOuf02f; download_guide=%223%2F20230824%2F0%22; IsDouyinActive=true; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A1920%2C%5C%22screen_height%5C%22%3A1080%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A8%2C%5C%22device_memory%5C%22%3A8%2C%5C%22downlink%5C%22%3A5.95%2C%5C%22effective_type%5C%22%3A%5C%224g%5C%22%2C%5C%22round_trip_time%5C%22%3A50%7D%22; VIDEO_FILTER_MEMO_SELECT=%7B%22expireTime%22%3A1693470886177%2C%22type%22%3Anull%7D; home_can_add_dy_2_desktop=%221%22; msToken=phFAWMM1fxkFc4oj6QE8_DMbU57I87HDv_NnoZ9uVNGkx1j9HDT-ddGbno81zAHZuXDF4OKjA1mHIchWdQYixYfFkSCi1Kb-1dKKjmHw_yz-YTa2wQ==; msToken=f_v0fvPvEDKoOBgIkJwOciMoWbigmQ0oZzhY2RgQfO2Otc1zIwtEkRE_kmn8FYYdXDQjAa0tfamm7kXHYD_1M3VrLvLvfQaIP2XtKctXHG4WNcKRyw==; xgplayer_user_id=180566107648');
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}



function get_redirect_url($url){
$header = get_headers($url, 1);
if (strpos($header[0], '301') !== false || strpos($header[0], '302') !== false) {
if(is_array($header['Location'])) {
return $header['Location'][count($header['Location'])-1];
}else{
return $header['Location'];
}
}else {
return $url;
}
}
?>
阿根达斯 发表于 2024-9-8 15:50
每次重新访问都是v26呢,难道是因为我架设到服务器上面的原因吗?
whz2009 发表于 2024-9-8 15:51
 楼主| 小奥 发表于 2024-9-8 15:58
阿根达斯 发表于 2024-9-8 15:50
每次重新访问都是v26呢,难道是因为我架设到服务器上面的原因吗?

"https:".$m->app->videoDetail->video->playAddr[0]->src
加个判断   上面这个地址出现V26就取下面这个
"https:".$m->app->videoDetail->video->playAddr[1]->src
shawnYang 发表于 2024-9-8 16:22
收藏下晚点看看
鬼见愁 发表于 2024-9-8 17:39
想找个车载的,支持安卓4.2的,一直没找到
Echo001 发表于 2024-9-8 18:04
非常实用,感谢大佬。
52soft 发表于 2024-9-8 18:20
这软件很好
satuo6278 发表于 2024-9-8 18:55
感谢大佬                        
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 10:47

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表