【原创】抖音无水印视频下载,PHP获取抖音原视频,抖音无水印下载源码

闲着蛋疼的一个获取抖音原视频(无水印)方法,下面贴代码

<?php
/**
 * 获取抖音无水印视频地址
 * @param string $url 抖音分享地址
 * @return json
 * @example 调用方法 例: echo douyin('http://v.douyin.com/UyxaDa/');
 * @author Reaper <a@0oo.ren>
 * @request https://www.52bz.la
 */
public function douyin($url)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
    $content = curl_exec($ch);
    curl_close($ch);

    $pattern = '/playAddr: "(.*?)",/';
    preg_match_all($pattern, $content, $matches);

    $ch = curl_init($matches[1][0]);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
    curl_exec($ch);
    $newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    curl_close($ch);
    $data = ['code' => 200, 'msg' => '获取成功!', 'download' => $newurl];
    return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}

2019.09 已失效 最新无水印源码地址:

原创文章(代码),来之不易,转载请注明原著!

Last modification:September 18th, 2019 at 09:49 am
如果觉得我的文章对你有用,请随意赞赏

2 comments

  1. 现在只能解析,不能去水印了

    1. Reaper
      @啊

      问题不大 回头我在研究研究

Leave a Comment