debug
This commit is contained in:
@@ -66,71 +66,29 @@ class VideoInfoPage extends BasePage
|
|||||||
{
|
{
|
||||||
if (empty($this->arrVideo)) {
|
if (empty($this->arrVideo)) {
|
||||||
|
|
||||||
// $arrVideo = json_decode($this->getContent(), true);
|
|
||||||
|
|
||||||
// $arrVideo = $arrVideo['list'][0] ?? [];
|
|
||||||
// // 如果结构不正确 → 返回空数组
|
|
||||||
// if (!$arrVideo) {
|
|
||||||
// return [];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 2. 检查播放地址
|
|
||||||
// $strPlayUrl = $arrVideo['vod_play_url'] ?? null;
|
|
||||||
|
|
||||||
// // 2. 判断是否有播放地址
|
|
||||||
// if (empty($arrVideo['vod_play_url'])) {
|
|
||||||
// // 无播放地址 → 丢弃该数据
|
|
||||||
// return [];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// unset($arrVideo['vod_play_url']);
|
|
||||||
|
|
||||||
// $arrPlayUrl = str_replace('#', '$', $strPlayUrl);
|
|
||||||
// $arrPlayUrl = explode('$', $arrPlayUrl);
|
|
||||||
|
|
||||||
// $arrPlayUrl = array_filter($arrPlayUrl);
|
|
||||||
|
|
||||||
// $arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
|
||||||
// foreach ($arrPlayUrl as $intKey => $arrVal) {
|
|
||||||
// $strUrl = $arrVal[1] ?? '';
|
|
||||||
// // *** 过滤掉不是 m3u8 的链接 ***
|
|
||||||
// if (!str_ends_with($strUrl, '.m3u8')) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// $arrPlayUrl[$intKey] = [
|
|
||||||
// 'name' => $arrVal[0],
|
|
||||||
// 'url' => $strUrl,
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
|
|
||||||
$arrVideo = json_decode($this->getContent(), true);
|
$arrVideo = json_decode($this->getContent(), true);
|
||||||
$arrVideo = $arrVideo['list'][0] ?? [];
|
$arrVideo = $arrVideo['list'][0] ?? [];
|
||||||
// 如果结构不正确 → 返回空数组
|
|
||||||
if (!$arrVideo) {
|
if (!$arrVideo) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
// 2. 检查播放地址
|
|
||||||
$strPlayUrl = $arrVideo['vod_play_url'] ?? null;
|
$strPlayUrl = $arrVideo['vod_play_url'] ?? null;
|
||||||
// 2. 判断是否有播放地址
|
|
||||||
if (empty($arrVideo['vod_play_url'])) {
|
if (empty($arrVideo['vod_play_url'])) {
|
||||||
// 无播放地址 → 丢弃该数据
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($arrVideo['vod_play_url']);
|
unset($arrVideo['vod_play_url']);
|
||||||
// 替换分隔符
|
|
||||||
$arrPlayUrl = str_replace('#', '$', $strPlayUrl);
|
$arrPlayUrl = str_replace('#', '$', $strPlayUrl);
|
||||||
// 拆成数组
|
|
||||||
$arrPlayUrl = explode('$', $arrPlayUrl);
|
$arrPlayUrl = explode('$', $arrPlayUrl);
|
||||||
// 清理空值
|
|
||||||
$arrPlayUrl = array_filter(array_map('trim', $arrPlayUrl));
|
$arrPlayUrl = array_filter(array_map('trim', $arrPlayUrl));
|
||||||
// 转成二维数组:[[name,url], [name,url], ...]
|
|
||||||
$arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
$arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
||||||
// 最终结构
|
|
||||||
$cleanPlayUrl = [];
|
$cleanPlayUrl = [];
|
||||||
foreach ($arrPlayUrl as $pair) {
|
foreach ($arrPlayUrl as $pair) {
|
||||||
$name = $pair[0] ?? '';
|
$name = $pair[0] ?? '';
|
||||||
$url = $pair[1] ?? '';
|
$url = $pair[1] ?? '';
|
||||||
// *** 过滤掉不是 m3u8 的链接 ***
|
|
||||||
if (!str_ends_with($url, '.m3u8')) {
|
if (!str_ends_with($url, '.m3u8')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,58 +66,29 @@ class VideoInfoPage extends BasePage
|
|||||||
{
|
{
|
||||||
if (empty($this->arrVideo)) {
|
if (empty($this->arrVideo)) {
|
||||||
|
|
||||||
// $arrVideo = json_decode($this->getContent(), true);
|
|
||||||
// $arrVideo = $arrVideo['list'][0];
|
|
||||||
// // print_r($arrVideo);
|
|
||||||
|
|
||||||
// $strPlayUrl = $arrVideo['vod_play_url'];
|
|
||||||
// unset($arrVideo['vod_play_url']);
|
|
||||||
|
|
||||||
// $arrPlayUrl = str_replace('#', '$', $strPlayUrl);
|
|
||||||
// $arrPlayUrl = explode('$', $arrPlayUrl);
|
|
||||||
|
|
||||||
// $arrPlayUrl = array_filter($arrPlayUrl);
|
|
||||||
// $arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
|
||||||
// foreach ($arrPlayUrl as $intKey => $arrVal) {
|
|
||||||
// $strUrl = $arrVal[1] ?? '';
|
|
||||||
// // *** 过滤掉不是 m3u8 的链接 ***
|
|
||||||
// if (!str_ends_with($strUrl, '.m3u8')) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// $arrPlayUrl[$intKey] = [
|
|
||||||
// 'name' => $arrVal[0],
|
|
||||||
// 'url' => $strUrl,
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
|
|
||||||
$arrVideo = json_decode($this->getContent(), true);
|
$arrVideo = json_decode($this->getContent(), true);
|
||||||
$arrVideo = $arrVideo['list'][0] ?? [];
|
$arrVideo = $arrVideo['list'][0] ?? [];
|
||||||
// 如果结构不正确 → 返回空数组
|
|
||||||
if (!$arrVideo) {
|
if (!$arrVideo) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
// 2. 检查播放地址
|
|
||||||
$strPlayUrl = $arrVideo['vod_play_url'] ?? null;
|
$strPlayUrl = $arrVideo['vod_play_url'] ?? null;
|
||||||
// 2. 判断是否有播放地址
|
|
||||||
if (empty($arrVideo['vod_play_url'])) {
|
if (empty($arrVideo['vod_play_url'])) {
|
||||||
// 无播放地址 → 丢弃该数据
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($arrVideo['vod_play_url']);
|
unset($arrVideo['vod_play_url']);
|
||||||
// 替换分隔符
|
|
||||||
$arrPlayUrl = str_replace('#', '$', $strPlayUrl);
|
$arrPlayUrl = str_replace('#', '$', $strPlayUrl);
|
||||||
// 拆成数组
|
|
||||||
$arrPlayUrl = explode('$', $arrPlayUrl);
|
$arrPlayUrl = explode('$', $arrPlayUrl);
|
||||||
// 清理空值
|
|
||||||
$arrPlayUrl = array_filter(array_map('trim', $arrPlayUrl));
|
$arrPlayUrl = array_filter(array_map('trim', $arrPlayUrl));
|
||||||
// 转成二维数组:[[name,url], [name,url], ...]
|
|
||||||
$arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
$arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
||||||
// 最终结构
|
|
||||||
$cleanPlayUrl = [];
|
$cleanPlayUrl = [];
|
||||||
foreach ($arrPlayUrl as $pair) {
|
foreach ($arrPlayUrl as $pair) {
|
||||||
$name = $pair[0] ?? '';
|
$name = $pair[0] ?? '';
|
||||||
$url = $pair[1] ?? '';
|
$url = $pair[1] ?? '';
|
||||||
// *** 过滤掉不是 m3u8 的链接 ***
|
|
||||||
if (!str_ends_with($url, '.m3u8')) {
|
if (!str_ends_with($url, '.m3u8')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -128,8 +99,6 @@ class VideoInfoPage extends BasePage
|
|||||||
}
|
}
|
||||||
$arrPlayUrl = $cleanPlayUrl;
|
$arrPlayUrl = $cleanPlayUrl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
|
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
|
||||||
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
|
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
|
||||||
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
|
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
|
||||||
|
|||||||
@@ -633,8 +633,13 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
// 获取某个线路的第一个 url
|
// 获取某个线路的第一个 url
|
||||||
function getFirstPlayUrl(playLine) {
|
function getFirstPlayUrl(playLine) {
|
||||||
return arrPlayUrl[playLine][0].url;
|
if (!arrPlayUrl || !arrPlayUrl[playLine] || !arrPlayUrl[playLine][0]) {
|
||||||
|
console.warn("播放线路不存在:", playLine, arrPlayUrl);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
return arrPlayUrl[playLine][0].url || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user