mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-22 05:36:32 +01:00
Add iptv-org/iptv-org.js
This commit is contained in:
parent
9ebd64d386
commit
3ca0899e22
1 changed files with 85 additions and 0 deletions
85
iptv-org/iptv-org.js
Normal file
85
iptv-org/iptv-org.js
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
async function searchResults(keyword) {
|
||||||
|
const results = [];
|
||||||
|
try {
|
||||||
|
const response = await fetchv2("https://iptv-org.github.io/iptv/index.m3u");
|
||||||
|
const m3uContent = await response.text();
|
||||||
|
|
||||||
|
const lines = m3uContent.split('\n');
|
||||||
|
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const line = lines[i].trim();
|
||||||
|
|
||||||
|
if (line.startsWith('#EXTINF:')) {
|
||||||
|
const logoMatch = line.match(/tvg-logo="([^"]*)"/);
|
||||||
|
const logo = logoMatch ? logoMatch[1] : '';
|
||||||
|
|
||||||
|
const lastCommaIndex = line.lastIndexOf(',');
|
||||||
|
const fullName = lastCommaIndex !== -1 ? line.substring(lastCommaIndex + 1).trim() : '';
|
||||||
|
|
||||||
|
const streamUrl = (i + 1 < lines.length) ? lines[i + 1].trim() : '';
|
||||||
|
|
||||||
|
const hlsEndings = [".m3u8", ".m3u", ".m3u?", ".m3u8?", ".m3u#", ".m3u8#"];
|
||||||
|
const urlLower = streamUrl.toLowerCase();
|
||||||
|
const isHls = hlsEndings.some(ending => urlLower.endsWith(ending));
|
||||||
|
if (fullName.toLowerCase().includes(keyword.toLowerCase()) && isHls) {
|
||||||
|
results.push({
|
||||||
|
title: fullName,
|
||||||
|
image: logo,
|
||||||
|
href: streamUrl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return JSON.stringify(results);
|
||||||
|
} catch (err) {
|
||||||
|
return JSON.stringify([{
|
||||||
|
title: "Error",
|
||||||
|
image: "Error",
|
||||||
|
href: "Error"
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function extractDetails(url) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify([{
|
||||||
|
description: "N/A",
|
||||||
|
aliases: "N/A",
|
||||||
|
airdate: "N/A"
|
||||||
|
}]);
|
||||||
|
} catch (err) {
|
||||||
|
return JSON.stringify([{
|
||||||
|
description: "Error",
|
||||||
|
aliases: "Error",
|
||||||
|
airdate: "Error"
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function extractEpisodes(url) {
|
||||||
|
const results = [];
|
||||||
|
try {
|
||||||
|
|
||||||
|
results.push({
|
||||||
|
href: url,
|
||||||
|
number: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return JSON.stringify(results);
|
||||||
|
} catch (err) {
|
||||||
|
return JSON.stringify([{
|
||||||
|
href: "Error",
|
||||||
|
number: "Error"
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function extractStreamUrl(url) {
|
||||||
|
try {
|
||||||
|
return url;
|
||||||
|
} catch (err) {
|
||||||
|
return "https://error.org/";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue