|
发表于 2025-7-4 20:52:26
|
显示全部楼层
<?php
$u = $_SERVER['QUERY_STRING'];
//$u = 'https://www.1905.com/vod/play/355722.shtml';
$ts = time();
$salt = "dde3d61a0411511d";
$playerId = substr($ts, 6) . substr(rand(), -3) . substr(rand(), -8);
$uuid = strtolower(
sprintf(
"%04X%04X-%04X-%04X-%04X-%04X%04X%04X",
mt_rand(0, 65535),
mt_rand(0, 65535),
mt_rand(0, 65535),
mt_rand(16384, 20479),
mt_rand(32768, 49151),
mt_rand(0, 65535),
mt_rand(0, 65535),
mt_rand(0, 65535)
)
);
preg_match('/\/(\d+)/', $u, $m);
$cid = $m[1];
$page = $u;
$params = [
"cid" => $cid,
"expiretime" => $ts + 600,
"nonce" => $ts,
"page" => $page,
"playerid" => $playerId,
"type" => "hls",
"uuid" => $uuid,
];
$sign = sha1(http_build_query($params) . "." . $salt);
//$params["appid"] = "GEalPdWA";
$params["signature"] = $sign;
$params["callback"] = "fnCallback0";
//$post = json_encode($params);
$url = "https://profile.m1905.com/mvod/getVideoinfo.php";
$url .= "?" . http_build_query($params);
//$headers = ["Authorization: " . $sign, "Content-Type: application/json"];
$data = file_get_contents($url);
preg_match('/\((.+)\)/', $data, $m);
$j = json_decode($m[1]);
$d = $j->data;
$q = $d->quality;
$s = $d->sign;
$p = $d->path;
if (isset($p->uhd))
$play_url = $q->uhd->host . $s->uhd->sign . $p->uhd->path;
elseif (isset($p->hd))
$play_url = $q->hd->host . $s->hd->sign . $p->hd->path;
elseif (isset($p->sd))
$play_url = $q->sd->host . $s->sd->sign . $p->sd->path;
else
$play_url = '';
//header("Content-Type: application/vnd.apple.mpegURL");
header("Access-Control-Allow-Origin: *");
header("Location: " . $play_url);
/*
使用:
http://localhost/a.php?https://www.1905.com/vod/play/355722.shtml
*/ |
|