Touchtv iptv代码备份

代码来自恩山论坛 wjxgzz

php版本:https://www.right.com.cn/forum/thread-8294817-1-1.html

nodejs版本:https://www.right.com.cn/forum/thread-8294618-1-1.html

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
    //触电新闻v3
    $pk = $_GET['pk'];
    $ts = time().'123';
    
    $pubKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALLUiZV6DVmAcJGOsWzftnYxDVpIdTlQynYeTtq5Z1ZzUteINPX24GyeetbYjnIT8pq0IdXGEjjBtngvddR0YaMCAwEAAQ==";
    $pubKey = "-----BEGIN PUBLIC KEY-----\n".wordwrap($pubKey,64,"\n",true)."\n-----END PUBLIC KEY-----";
    $randIMEI = substr(md5(rand(10000000,99999999)),rand(0,15),16);
    
    openssl_public_encrypt("IMEI_".$randIMEI,$encData,$pubKey);

    $headers = [
        "X-ITOUCHTV-Ca-Key: 04039368653554864194910691389924",
        "referer: https://android.itouchtv.cn/".$randIMEI,
        "X-ITOUCHTV-A01: ".base64_encode($encData),
        "X-ITOUCHTV-CLIENT: NEWS_APP",
        "User-Agent: Mozilla/5.0 (Linux; Android 13.1.2;)",
        "X-ITOUCHTV-APP-VERSION: 4.9.2",
        "X-ITOUCHTV-Ca-Timestamp: $ts",
        "X-ITOUCHTV-A05: hFiVdSB9XwdEevy3UZlmj2BFW1o8S6MRLQVj1z7hBU4IfPS4tawaISroHYLgA5d1PcI2rIQCAud1nYH19Ks95A==", // 44
        "X-ITOUCHTV-RESOLUTION: 1920,1080",
        "X-ITOUCHTV-OSVS: 13.1.2"
    ];

    $signkey = "qmiHeB9bKgowHqxRv0prc2cPN2EwXL1HOYu3DPiYCcaYxyxdFIyT5mAfBmr0UKPO";
    $bstrURL = "https://tcdn-api.itouchtv.cn/getParam";
    $sign =base64_encode(hash_hmac("SHA256","GET\n$bstrURL\n$ts\n",$signkey,true));
    $headers[] = "X-ITOUCHTV-Ca-Signature:$sign";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $bstrURL);                  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
    curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
    $data = curl_exec($ch);
    curl_close($ch);
    $json = json_decode($data);
    $node = $json->node;
    array_pop($headers);
    
    $bstrURL = "https://api.itouchtv.cn/liveservice/v3/tvChannelList?node=$node";

    $sign = base64_encode(hash_hmac("SHA256","GET\n$bstrURL\n$ts\n",$signkey,true));
    $headers[] = "X-ITOUCHTV-Ca-Signature:$sign";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $bstrURL);                  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
    curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
    $data = curl_exec($ch);
    //echo $data;exit;
    curl_close($ch);
        
    if($pk == '')
    {
        $json = json_decode($data);
        foreach($json->tvChannelList as $out)
        {
            echo ($out->name.','.$out->pk.'<br />');
        }
    }
    else
    {
        preg_match('/pk":'.$pk.',.*?"url":"(.*?)"/i',$data,$result);
        $playURL = $result[1];
        header("location:$playURL");
    }
?>
updatedupdated2024-11-302024-11-30