抖音增加视频播放量接口PHP实例源码

2021-09-15 11:35:40 浏览数 (1)

介绍

原理就是通过访问抖音官方API,访问一次涨一个播放,可以增加自己视频的播放量!

下面PHP实例是访问一次执行一次,自己有能力可以写个循环,或者多线程什么的,增长速度嗷嗷的~

需要用到的接口

【URL】 https://api-hl.amemv.com/aweme/v1/aweme/stats/?os_api=22&device_type=google Pixel 2&device_platform=android&ssmix=a&iid=74822863591&manifest_version_code=660&dpi=480&js_sdk_version=1.16.3.1&uuid=865166021416204&version_code=660&app_name=aweme&version_name=6.6.0&ts=【毫秒时间戳】&openudid=c0bcff522b31988e&device_id=67793419030&resolution=1080*1920&os_version=5.1.1&language=zh&device_brand=google&ac=wifi&update_version_code=6602&aid=1128&channel=update&_rticket=【毫秒时间戳】&mcc_mnc=46000 【POST】 os_api=22&device_type=google Pixel 2&ssmix=a&manifest_version_code=660&dpi=480&uuid=865166021416204&js_sdk_version=1.16.3.1&app_name=aweme&aweme_type=0&tab_type=3&version_name=6.6.0&ts=1564999230&retry_type=no_retry&ac=wifi&channel=update&update_version_code=6602&_rticket=【毫秒时间戳】&device_platform=android&iid=74822863591&version_code=660&item_id=【作品19位数字ID】&openudid=c0bcff522b31988e&device_id=67793419030&resolution=1080*1920&device_brand=google&language=zh&os_version=5.1.1&play_delta=1&aid=1128&mcc_mnc=46000

本文作者:雨尘

文章标题:抖音增加视频播放量接口PHP实例源码

本文地址:https://www.jufb.cn/archives/42.html

PHP实例源码

代码语言:javascript复制
function bofang($item_id){
    $time = getMillisecond();
    $url = 'https://api-hl.amemv.com/aweme/v1/aweme/stats/?os_api=22&device_type=google Pixel 2&device_platform=android&ssmix=a&iid=74822863591&manifest_version_code=660&dpi=480&js_sdk_version=1.16.3.1&uuid=865166021416204&version_code=660&app_name=aweme&version_name=6.6.0&ts='.$time.'&openudid=c0bcff522b31988e&device_id=67793419030&resolution=1080*1920&os_version=5.1.1&language=zh&device_brand=google&ac=wifi&update_version_code=6602&aid=1128&channel=update&_rticket='.$time.'&mcc_mnc=46000';
    $post = 'os_api=22&device_type=google Pixel 2&ssmix=a&manifest_version_code=660&dpi=480&uuid=865166021416204&js_sdk_version=1.16.3.1&app_name=aweme&aweme_type=0&tab_type=3&version_name=6.6.0&ts=1564999230&retry_type=no_retry&ac=wifi&channel=update&update_version_code=6602&_rticket='.$time.'&device_platform=android&iid=74822863591&version_code=660&item_id='.$item_id.'&openudid=c0bcff522b31988e&device_id=67793419030&resolution=1080*1920&device_brand=google&language=zh&os_version=5.1.1&play_delta=1&aid=1128&mcc_mnc=46000';
    $res = json_decode(curl($url,$post),true);
    if($res['status_code']==0){
        exit('{"code":200,"msg":"成功"}');
    }else{
        exit('{"code":0,"msg":"未知错误请重试"}');
    }
}


function getMillisecond(){
    list($msec, $sec) = explode(' ', microtime());
    $msectime = (float)sprintf('%.0f', (floatval($msec)   floatval($sec)) * 1000);
    return $msectimes = substr($msectime,0,13);
}



function curl($url,$post=0,$referer=0,$cookie=0,$header=0,$ua=0,$nobaody=0){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    $httpheader[] = "X-SS-STUB: B828E3CB70F3EFEF53E003C994F45C39";
    $httpheader[] = "Accept-Encoding: gzip";
    $httpheader[] = "sdk-version: 1";
    $httpheader[] = 'Cookie: odin_tt=64fd2688121fa8e6755f1c1d9b58114ee0cdf4f62c5be1b8925786d61d03e4e5014ed9a5383f8dc76ec3edb1f6e55fef; sid_guard=073c029d2755c136b102a5e60dd11966|1563332663|5184000|Sun, 15-Sep-2019 03:04:23 GMT; uid_tt=c46b2b611031431bcd1eb9625dc59a8d; sid_tt=073c029d2755c136b102a5e60dd11966; sessionid=073c029d2755c136b102a5e60dd11966; qh[360]=1; install_id=74822863591; ttreq=1$54152ab2bdbfd45c85cf5147fa37b1ede874857a';
    $httpheader[] = "x-tt-token: 00073c029d2755c136b102a5e60dd119661355b20dfb99291576ca5075f0703ffccbd5380e5fe648bb5610e3bcebcd3dbb43";
    $httpheader[] = "X-Gorgon: 03c00000840006b73cf02493143897e10a8858c48f571e66c038";
    $httpheader[] = "X-Khronos: 1565000714";
    $httpheader[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
    $httpheader[] = "Content-Length: 525";
    $httpheader[] = "Host: api-hl.amemv.com";
    $httpheader[] = "Connection: Keep-Alive";
    $httpheader[] = "User-Agent: okhttp/3.10.0.1";

    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    if($post){
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
    if($header){
        curl_setopt($ch, CURLOPT_HEADER, TRUE);
    }
    if($cookie){
        curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    }
    if($referer){
        if($referer==1){
            curl_setopt($ch, CURLOPT_REFERER, 'https://api-hl.amemv.com/');
        }else{
            curl_setopt($ch, CURLOPT_REFERER, $referer);
        }
    }
    if($ua){
        curl_setopt($ch, CURLOPT_USERAGENT,$ua);
    }else{
        curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
    }
    if($nobaody){
        curl_setopt($ch, CURLOPT_NOBODY,1);
    }
    curl_setopt($ch, CURLOPT_ENCODING, "gzip");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $ret = curl_exec($ch);
    curl_close($ch);
    return $ret;
}
bofang(19位数字ID); //执行

0 人点赞