debug
This commit is contained in:
@@ -65,72 +65,30 @@ class VideoInfoPage extends BasePage
|
||||
public function getVideo(): array
|
||||
{
|
||||
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 = $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(array_map('trim', $arrPlayUrl));
|
||||
// 转成二维数组:[[name,url], [name,url], ...]
|
||||
$arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
||||
// 最终结构
|
||||
|
||||
$cleanPlayUrl = [];
|
||||
foreach ($arrPlayUrl as $pair) {
|
||||
$name = $pair[0] ?? '';
|
||||
$url = $pair[1] ?? '';
|
||||
// *** 过滤掉不是 m3u8 的链接 ***
|
||||
if (!str_ends_with($url, '.m3u8')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -66,58 +66,29 @@ class VideoInfoPage extends BasePage
|
||||
{
|
||||
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 = $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(array_map('trim', $arrPlayUrl));
|
||||
// 转成二维数组:[[name,url], [name,url], ...]
|
||||
$arrPlayUrl = array_chunk($arrPlayUrl, 2);
|
||||
// 最终结构
|
||||
|
||||
$cleanPlayUrl = [];
|
||||
foreach ($arrPlayUrl as $pair) {
|
||||
$name = $pair[0] ?? '';
|
||||
$url = $pair[1] ?? '';
|
||||
// *** 过滤掉不是 m3u8 的链接 ***
|
||||
if (!str_ends_with($url, '.m3u8')) {
|
||||
continue;
|
||||
}
|
||||
@@ -127,8 +98,6 @@ class VideoInfoPage extends BasePage
|
||||
];
|
||||
}
|
||||
$arrPlayUrl = $cleanPlayUrl;
|
||||
|
||||
|
||||
|
||||
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
|
||||
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
|
||||
|
||||
@@ -633,8 +633,13 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// 获取某个线路的第一个 url
|
||||
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