[    [    [    [    [    [    [    b l o g g i n   s p a c e    wiki   ]    ]    ]    ]    ]    ]    ]

Difference between revisions of "Football"

From blogginpedia
Jump to navigation Jump to search
Line 2: Line 2:
<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>


<div id="lotus-links" style="font-family: Arial, sans-serif; padding: 10px; max-width: 100%;"></div>
<div id="lotus-streams">Loading streams...</div>


<script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Step 1: Fetch JSON as plain text (this works despite CORS for <script>)
   const container = document.getElementById('lotus-links');
const script = document.createElement('script');
   container.innerHTML = '<p>Loading streams...</p>'; // Show loading
script.src = 'https://lotusgamehd.xyz/api-event.php';
script.onload = function() {
  // JSON loaded into global var (rename to avoid conflicts)
   const data = window.lotusJsonData; // Set in next step
  renderLinks(data);
   delete window.lotusJsonData; // Cleanup
};
document.head.appendChild(script);


  fetch('https://lotusgamehd.xyz/api-event.php')
// Step 2: Alternative if script fails — use data URL iframe (base64 proxy)
    .then(response => {
const fallbackIframe = document.createElement('iframe');
      if (!response.ok) throw new Error('API unavailable');
fallbackIframe.id = 'lotus-fallback';
      return response.json();
fallbackIframe.style.display = 'none';
    })
document.body.appendChild(fallbackIframe);
    .then(data => {
      if (!data.days || data.days.length === 0) throw new Error('No events found');


      // Extract stream links only
setTimeout(() => {
       const links = [];
  if (!window.lotusJsonData) {
       data.days.forEach(day => {
    // Fetch as text for base64
         day.items.forEach(event => {
    fetch('https://lotusgamehd.xyz/api-event.php')
           if (event.streams && event.streams.length > 0) {
       .then(r => r.text())
            const stream = event.streams[0]; // First stream
       .then(text => {
            links.push({
         const encoded = btoa(unescape(encodeURIComponent(text))); // UTF-8 safe base64
              url: stream.link,
        fallbackIframe.src = 'data:text/html;base64,' + encoded;
              title: event.title,
        fallbackIframe.onload = () => {
              league: (event.league || 'Unknown').toUpperCase(),
           const doc = fallbackIframe.contentDocument;
              time: event.when_et ? event.when_et.split(' ')[1] : '', // e.g., "20:20"
          const jsonText = doc.body.textContent;
              status: event.status === 'LIVE' ? '🔴 LIVE' : '⏰ UPCOMING'
          const data = JSON.parse(jsonText);
            });
          renderLinks(data);
          }
          fallbackIframe.remove();
        });
        };
      })
      .catch(() => {
        document.getElementById('lotus-streams').innerHTML = '<p style="color:red;">Both methods failed — try incognito or disable adblocker.</p>';
       });
       });
  }
}, 1000); // Give script time


      if (links.length === 0) {
// Step 3: Common render function
        container.innerHTML = '<p style="color: orange;">No streams available right now.</p>';
function renderLinks(data) {
         return;
  const output = document.getElementById('lotus-streams');
  if (!data || !data.days) {
    output.innerHTML = '<p style="color:orange;">No events found.</p>';
    return;
  }
 
  // Extract links
  const links = [];
  data.days.forEach(day => {
    day.items.forEach(event => {
      if (event.streams?.[0]?.link) {
         links.push({
          url: event.streams[0].link,
          title: event.title,
          league: (event.league || 'Unknown').toUpperCase(),
          time: event.when_et ? event.when_et.split(' ')[1] : '',
          status: event.status === 'LIVE' ? '🔴 LIVE' : '⏰ UPCOMING'
        });
       }
       }
    });
  });


      // Sort: LIVE first
  if (links.length === 0) {
      links.sort((a, b) => (b.status.includes('LIVE') ? 1 : 0) - (a.status.includes('LIVE') ? 1 : 0));
    output.innerHTML = '<p>No streams available.</p>';
    return;
  }


      // Render as responsive cards
  // Sort LIVE first
      container.innerHTML = `
  links.sort((a, b) => (b.status.includes('LIVE') ? 1 : 0) - (a.status.includes('LIVE') ? 1 : 0));
        <h3 style="margin: 0 0 10px 0; color: #333;">🔗 Active Streams (${links.length})</h3>
 
        <div style="display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));">
  // Render cards
          ${links.map(link => `
  output.innerHTML = `
            <a href="${link.url}" target="_blank" rel="noopener"
    <h3 style="color:#333; margin-bottom:10px;">🔗 Active Streams (${links.length})</h3>
              style="display: block; padding: 12px; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);  
    <div style="display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));">
                      border: 1px solid #dee2e6; border-radius: 8px; text-decoration: none;  
      ${links.map(l => `
                      color: #212529; font-weight: 500; transition: box-shadow 0.2s;
        <a href="${l.url}" target="_blank" rel="noopener noreferrer"
                      box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
          style="display: block; padding: 12px; background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);  
              <div style="font-size: 0.85em; color: #6c757d; margin-bottom: 4px;">
                  border: 1px solid #b3d9ff; border-radius: 8px; text-decoration: none;  
                ${link.status} • ${link.league} • ${link.time}
                  color: #1e40af; font-weight: 500; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
              </div>
                  transition: transform 0.2s, box-shadow 0.2s;">
              <div style="font-size: 1em; color: #212529;">${link.title}</div>
          <div style="font-size: 0.85em; color: #64748b; margin-bottom: 4px;">
            </a>
            ${l.status} • ${l.league} • ${l.time}
          `).join('')}
          </div>
        </div>
          <div style="font-size: 1em; color: #1e40af; font-weight: bold;">${l.title}</div>
        <p style="font-size: 0.8em; color: #6c757d; margin-top: 15px; text-align: right;">
        </a>
          Updated: ${new Date().toLocaleString('en-US', { timeZone: 'America/New_York', hour12: true })} ET
      `).join('')}
        </p>
    </div>
       `;
    <p style="font-size: 0.8em; color: #94a3b8; margin-top: 15px; text-align: right;">
      Updated: ${new Date().toLocaleString('en-US', { timeZone: 'America/New_York', hour12: true })} ET
    </p>
  `;
}
</script>
 
<!-- Fallback: JSONP-like script tag to load data globally -->
<script id="lotus-json-loader">
(function() {
  fetch('https://lotusgamehd.xyz/api-event.php')
    .then(r => r.text())
    .then(text => {
       window.lotusJsonData = JSON.parse(text);
     })
     })
     .catch(error => {
     .catch(() => {}); // Silent fail to fallback
      console.error('Fetch error:', error); // For debugging
})();
      container.innerHTML = `<p style="color: red;">Failed to load streams: ${error.message}.
                              <br><small>Check console (F12) for details or try refreshing.</small></p>`;
    });
});
</script>
</script>


</html>
</html>
[[Category:Sports]][[Category:Video]]
[[Category:Sports]][[Category:Video]]

Revision as of 00:41, 17 November 2025

Loading streams...