|
发表于 2025-9-8 20:15:52
|
显示全部楼层
<?php
//https://www.xuexi.cn/3271716c843e44c7e00e66e38ad6fcd5/e2c3733327a5a413f63fc980e92f4552.html
$id = $_GET['id'];
$h[] = 'content-type: application/json';
$h[] = 'svver: 2';
$t = intval(microtime(true) * 1000);
$r = mt_rand(1000, 9999);
$h[] = "x-lwp-uid: $t$r@pc-live";
$u = "https://www.xuexi.cn/lgdata/$id.json";
$c = file_get_contents($u);
preg_match('/"itemId":"([^"]+)"/', $c, $m);
$item_id = $m[1];
preg_match('/"videoLink":"([^"]+)"/', $c, $m);
$res_url = $m[1];
$r = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 11);
$t1 = intval(microtime(true) * 1000);
$t2 = $t1 + mt_rand(100, 999);
$y_uid = $request_id = "{$id}_{$r}_{$t1}_{$t2}";
$res_type = 201;
$y_token = hash('sha256', "{$res_url}_{$res_type}_{$request_id}_1d66f6b2-442a-4834-ba8c-c265e8769931");
$p = json_encode([
"res_type" => $res_type,
"res_url" => $res_url,
"request_id" => $request_id,
"item_id" => $item_id,
"y_uid" => $y_uid,
"y_token" => $y_token,
], JSON_UNESCAPED_SLASHES);
$u = 'https://gw-proxy-api.xuexi.cn/v1/api/exchangeAuthUrl';
$c = file_get_contents($u, false, stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => implode("\r\n", $h),
'content' => $p,
)
)));
$j = json_decode($c, true);
$d = $j['data'];
$key = hash('sha256', base64_encode($d['timestamp'].$y_token), true);
$iv = md5($key, true);
$l = openssl_decrypt($d['auth_url'], 'AES-256-CBC', $key, 0, $iv);
header('Access-Control-Allow-Origin: *');
header('Location: '.$l); |
|