Top Ad unit 728 × 90

Share code api getlink nhaccuatui

nhaccutui.com là một trang nghe nhạc lớn chắc hẳn các bạn đã biết và hôm nay mình sẽ giới thiệu một functon mà mình viết để get link nhạc từ nhạc của tui - com

Share code get Link Download 320kbps NhacCuaTui


<?php

/**
 * Code based by Nguyen Huu Dat - https://www.facebook.com/dl2811
 * Code được chia sẻ miễn phí tại J2TEAM Community - https://www.facebook.com/groups/j2team.community
 * Website: https://trolyfacebook.com
 * Code for Chatfuel by Le Hoang - https://www.facebook.com/lehoangnb
 *
 */

function gettoken()
{
    $headers   = array();
    $headers[] = 'Content-Type: application/x-www-form-urlencoded';
    $headers[] = 'Host: graph.nhaccuatui.com';
    $headers[] = 'Connection: Keep-Alive';
    
    
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, "https://graph.nhaccuatui.com/v3/commons/token");
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($c, CURLOPT_POST, 1);
    curl_setopt($c, CURLOPT_POSTFIELDS, "deviceinfo=%7B%22DeviceID%22%3A%2206C6F6391B162B7376615C3BB19C3F81%22%2C%22OsName%22%3A%22WINOS%22%2C%22OsVersion%22%3A%2210%22%2C%22AppName%22%3A%22TrolyFacebook%22%2C%22AppVersion%22%3A%226.0.5%22%2C%22UserName%22%3A%22TrolyFacebook.Com%22%2C%22DeviceName%22%3A%22%22%2C%22Provider%22%3A%22DatNguyen%22%2C%22QualityPlay%22%3A%22128%22%2C%22QualityDownload%22%3A%22128%22%2C%22QualityCloud%22%3A%22128%22%2C%22Network%22%3A%22WIFI%22%7D&md5=08ed8ef85801a129ec56635af943e8a3&timestamp=1482155807102&number=&ip=&refesh_token=5944aa2d54000adb75868f29ef5ddb9d");
    
    
    $page = curl_exec($c);
    curl_close($c);
    
    $infotoken = json_decode($page);
    $token     = $infotoken->data->{2};
    return $token;
}


function getlink($idbaihat, $token)
{
    $linklist = 'https://graph.nhaccuatui.com/v3/songs/' . $idbaihat . '?access_token=' . $token . '&number=&pagetracking=PlaySong&iscloud=false&ip=123.30.134.2';
    $c        = curl_init();
    curl_setopt($c, CURLOPT_URL, $linklist);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
    
    $page = curl_exec($c);
    curl_close($c);
    
    $data = json_decode($page);
    return $data;
}

if (isset($_GET['url'])) {
    $url      = $_GET['url'];
    $temp     = explode(".", $url);
    $idbaihat = trim($temp[3]);
    if ($idbaihat != "") {
        $token = gettoken();
        if ($token != "") {
            $data = getlink($idbaihat, $token);
            
            //  $linkplay     = $data->data->{7};
            $link128      = $data->data->{11};
            $link320      = $data->data->{12};
            $linklossless = $data->data->{19};
            //  $thumbnail    = $data->data->{8};
            $tenbaihat    = $data->data->{2};
            $casy         = $data->data->{3};
            $luotnghe     = $data->data->{5};
            $album        = $data->data->{14};
        }
        if ($tenbaihat != "") {
            $tenfile = "$tenbaihat - $casy";
        }
        
        
        $result = array(
            "messages" => array(
                array(
                    "text" => "Tên bài hát:  $tenfile \nLượt nghe: $luotnghe"
                ),
                
                array(
                    "attachment" => array(
                        "type" => "template",
                        "payload" => array(
                            "template_type" => "button",
                            "text" => "Bấm nút bên dưới để tải về!",
                            "buttons" => array(
                                array(
                                    "type" => "web_url",
                                    "url" => $link128,
                                    "title" => "128Kbs"
                                ),
                                array(
                                    "type" => "web_url",
                                    "url" => $link320,
                                    "title" => "320Kbs"
                                ),
                                array(
                                    "type" => "web_url",
                                    "url" => $linklossless,
                                    "title" => "LossLess"
                                )
                            )
                        )
                    )
                )
            )
        );
        echo json_encode($result);
        header("Status: 200");
    }
}
?>

Share code api getlink nhaccuatui Reviewed by Cuong Nguyen on April 25, 2017 Rating: 5

No comments:

All Rights Reserved by Blog Chia Sẻ © 2014 - 2015
Powered by Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.