Difference between revisions of "Football"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
<html> | <html> | ||
<iframe src="https://lotusgamehd.xyz/lotushd.php?hd=260" width="81%" height="500" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" allowfullscreen="yes"></iframe> | <iframe src="https://lotusgamehd.xyz/lotushd.php?hd=260" width="81%" height="500" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" allowfullscreen="yes"></iframe> | ||
<iframe | |||
id="lotus-iframe" | |||
src="https://lotusgamehd.xyz/api-event.php" | |||
width="100%" | |||
height="0" | |||
style="border:none; height:0; overflow:hidden;" | |||
onload="renderLotusLinks(this)" | |||
></iframe> | |||
<script> | |||
function renderLotusLinks(iframe) { | |||
// Step 1: Extract raw JSON from iframe | |||
const doc = iframe.contentDocument || iframe.contentWindow.document; | |||
const pre = doc.body.querySelector('pre'); | |||
if (!pre) { | |||
iframe.before('<p style="color:red">Failed to load data.</p>'); | |||
iframe.remove(); | |||
return; | |||
} | |||
let data; | |||
try { | |||
data = JSON.parse(pre.textContent); | |||
} catch (e) { | |||
iframe.before('<p style="color:red">Invalid JSON.</p>'); | |||
iframe.remove(); | |||
return; | |||
} | |||
// Step 2: Extract only stream links | |||
const links = []; | |||
data.days.forEach(day => { | |||
day.items.forEach(event => { | |||
if (event.streams && event.streams[0]?.link) { | |||
links.push({ | |||
url: event.streams[0].link, | |||
title: event.title, | |||
league: (event.league || '').toUpperCase(), | |||
time: event.when_et?.split(' ')[1] || '', | |||
live: event.status === 'LIVE' | |||
}); | |||
} | |||
}); | |||
}); | |||
if (links.length === 0) { | |||
iframe.before('<p>No streams available.</p>'); | |||
iframe.remove(); | |||
return; | |||
} | |||
// Step 3: Sort: LIVE first | |||
links.sort((a, b) => b.live - a.live); | |||
// Step 4: Build clean link list | |||
const container = document.createElement('div'); | |||
container.innerHTML = ` | |||
<h3>Live & Upcoming Streams <small>(${links.length})</small></h3> | |||
<div style="display:grid; gap:8px; grid-template-columns:repeat(auto-fill,minmax(260px,1fr));"> | |||
${links.map(l => ` | |||
<a href="${l.url}" target="_blank" | |||
style="display:block; padding:12px; background:#f8f9fa; border:1px solid #ddd; | |||
border-radius:8px; text-decoration:none; color:#1a0dab; font-weight:500;"> | |||
<div style="font-size:0.9em; color:#555;"> | |||
${l.live ? 'LIVE' : 'UPCOMING'} ${l.league} • ${l.time} | |||
</div> | |||
<div style="margin-top:4px; font-weight:bold;">${l.title}</div> | |||
</a> | |||
`).join('')} | |||
</div> | |||
<p style="font-size:0.8em; color:#666; margin-top:12px;"> | |||
Updated: ${new Date().toLocaleString('en-CA', { timeZone: 'America/Toronto' })} | |||
</p> | |||
`; | |||
// Step 5: Replace iframe with links | |||
iframe.before(container); | |||
iframe.remove(); | |||
} | |||
</script> | |||
</html> | </html> | ||
[[Category:Sports]][[Category:Video]] | [[Category:Sports]][[Category:Video]] | ||
Revision as of 00:34, 17 November 2025