Skip to content

Commit 2c5aa79

Browse files
authored
Update live.js
1 parent 57c7d49 commit 2c5aa79

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dashboard/src/api/services/live.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ class LiveService {
126126

127127
for (let i = 0; i < lines.length; i++) {
128128
const line = lines[i]
129-
129+
// 跳过空行
130+
if (!line) continue;
131+
130132
if (line.startsWith('#EXTINF:')) {
131133
// 解析频道信息 - 修复正则表达式来正确处理属性和频道名称
132-
const match = line.match(/#EXTINF:(-?\d+),(.*)$/)
134+
const match = line.match(/^#EXTINF:([-\.\d]+)\s*(.*)$/);
133135
if (match) {
134136
const duration = match[1]
135137
const fullStr = match[2].trim()
@@ -483,4 +485,4 @@ class LiveService {
483485
// 创建单例实例
484486
const liveService = new LiveService()
485487

486-
export default liveService
488+
export default liveService

0 commit comments

Comments
 (0)