各种某音去水印源码,PHP、Python、易语言 - 七彩资源网

各种某音去水印源码,PHP、Python、易语言

作者: 七彩网络

全网最全的网络资源分享网站

手机扫码查看

标签:

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!

Python

复制代码保存py格式可直接运行

</blockquote></div><div><div class="blockcode"><blockquote>import re

import requests, json

url = 'https://v.douyin.com/JB7VyAw/'
api = 'https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='

header = {
    'user-agent': 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7'
}


def video_url():
    url = input("输入抖音链接:")
    bdurl = r"http?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
    url = re.findall(bdurl, url)

    text = requests.get(url[0], headers=header)

    ress = r'''(?<=share/video/).*(?=/)'''
    res = re.findall(ress, text.url)

    id_url = api + res[0]
    urls = requests.get(id_url,headers=header)


    videos = urls.json()['item_list'][0]['video']['play_addr']['url_list']

    wat = videos[0].replace('wm','')    # 去水印后地址
    print(wat)
    t = requests.get(wat,headers=header).content
    with open('就是刚刚的抖音.mp4','wb') as data_file:
        data_file.write(t)
        input('获取成功!按回车退出........')

    #print(t.text)<font size="6"><font face="-apple-system, BlinkMacSystemFont, &quot;">

video_url()</font></font>

PHP版

public function getLink(Request $request){
    $url = I('url');
    $pattern = '{(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?}';
    preg_match($pattern,$url,$url);
    if ($url){
        $update['share_url'] = (string)$url[0];
    }else{
        $this->returnJson(0,'error',['code'=>0,'msg'=>'获取失败']);
    }
    $res = Db::name('log')->where('share_url',$update['share_url'])->find();
    $reqData['code'] = 1;
    $reqData['msg'] = '解析成功';
    if (!$res){
        $url = (string)$url[0];
        $pattern = '{(?<=\.).*(?=\.com)}';
        preg_match($pattern,$url,$type);
        $type = (string)$type[0];
        switch ($type){
            case 'douyin':
                $res = $this->douyin($url,'insert');
                break;
            case 'kuaishou':
                $res = $this->ks($url,'insert');
                break;
            default:
                $this->returnJson(0,'error',['code'=>0,'msg'=>'暂不支持该网站']);
                break;
        }
        $reqData['addr'] = $res['addr_url'];
        $reqData['title'] = $res['title'];
        $reqData['cover'] = $res['cover'];
        $reqData['is_url'] = $res['is_url'];
        $this->returnJson(1,'success',$reqData);
    }else{
        //查询是否超过一小时,超过则更新
        $over_time = time() - $res['create_time'];
        if ($over_time>3600){
            $url = (string)$url[0];
            $pattern = '{(?<=\.).*(?=\.com)}';
            preg_match($pattern,$url,$type);
            $type = (string)$type[0];
            if ($type=='douyin'){
                $res = $this->douyin($url,'update');
            }elseif ($type=='kuaishou'){
                $res = $this->ks($url,'update');
            }
            $reqData['addr'] = $res['addr_url'];
            $reqData['title'] = $res['title'];
            $reqData['cover'] = $res['cover'];
            $reqData['is_url'] = $res['is_url'];
            $this->returnJson(1,'success',$reqData);
        }else{
            $reqData['addr'] = $res['addr_url'];
            $reqData['cover'] = $res['cover'];
            $reqData['title'] = $res['title'];
            $reqData['is_url'] = $res['is_url'];
            $this->returnJson(1,'success',$reqData);
        }

    }
}
protected function douyin($url,$action = 'insert'){
    $update['share_url'] = $url;
    $url = get_headers($url,true);
    $url = $url['location'];
    $pattern = '{(?<=share\/video\/).*(?=\/)}';
    preg_match($pattern,$url,$video_id);
    $video_id = $video_id[0];
    $ql = QueryList::get('https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='.$video_id);
    $res = json_decode($ql->getHtml(),true);
    $url = $res['item_list'][0]['video']['play_addr']['url_list'][0];
    $update['title'] = $res['item_list'][0]['share_info']['share_title'];
    $update['cover'] = $res['item_list'][0]['music']['cover_large']['url_list'][0];
    $update['create_time'] = time();
    $url = str_replace('playwm','play',$url);
    $update['is_url'] = $url;
    $url = get_headers($url,true);
    $url = $url['location'];
    $update['addr_url'] = $url;
    if ($action=='insert'){
        $id = Db::name('log')->insertGetId($update);
        $res = Db::name('log')->where('id',$id)->find();
    }else{
        $res = Db::name('log')->where('share_url',$update['share_url'])->update($update);
        $res = Db::name('log')->where('share_url',$update['share_url'])->find();
    }
    return $res;
}

易语言

易语言下载地址:

百度云盘: https://pan.baidu.com/s/16T83ycLHVQ_m8nJgrGgXKQ 提取码: v4i3
蓝奏:https://wws.lanzous.com/ixlJYgylqmj

分享到:
打赏
未经允许不得转载:

作者: 七彩网络, 转载或复制请以 超链接形式 并注明出处 七彩资源网
原文地址: 《各种某音去水印源码,PHP、Python、易语言》 发布于2020-10-7

评论

切换注册

登录

您也可以使用第三方帐号快捷登录

切换登录

注册

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏