mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-04 03:36:29 +08:00
Fix fetch m3u failed when m3u file without extinf.
This commit is contained in:
@@ -15,8 +15,8 @@ export const parseM3U = (m3uText: string): Channel[] => {
|
|||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const trimmedLine = line.trim();
|
const trimmedLine = line.trim();
|
||||||
|
currentChannelInfo = { id: '', name: '', url: '', logo: '', group: '' };
|
||||||
if (trimmedLine.startsWith('#EXTINF:')) {
|
if (trimmedLine.startsWith('#EXTINF:')) {
|
||||||
currentChannelInfo = { id: '', name: '', url: '', logo: '', group: '' };
|
|
||||||
const commaIndex = trimmedLine.indexOf(',');
|
const commaIndex = trimmedLine.indexOf(',');
|
||||||
if (commaIndex !== -1) {
|
if (commaIndex !== -1) {
|
||||||
currentChannelInfo.name = trimmedLine.substring(commaIndex + 1).trim();
|
currentChannelInfo.name = trimmedLine.substring(commaIndex + 1).trim();
|
||||||
@@ -32,7 +32,6 @@ export const parseM3U = (m3uText: string): Channel[] => {
|
|||||||
currentChannelInfo.url = trimmedLine;
|
currentChannelInfo.url = trimmedLine;
|
||||||
currentChannelInfo.id = currentChannelInfo.url; // Use URL as ID
|
currentChannelInfo.id = currentChannelInfo.url; // Use URL as ID
|
||||||
parsedChannels.push(currentChannelInfo as Channel);
|
parsedChannels.push(currentChannelInfo as Channel);
|
||||||
currentChannelInfo = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parsedChannels;
|
return parsedChannels;
|
||||||
@@ -67,4 +66,4 @@ export const getPlayableUrl = (originalUrl: string | null): string | null => {
|
|||||||
}
|
}
|
||||||
// HTTPS streams can be played directly.
|
// HTTPS streams can be played directly.
|
||||||
return originalUrl;
|
return originalUrl;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user