streams API

The Streams API provides access to live streaming sources for sports events. These endpoints return stream details that can be used to embed or access video streams for matches.

Stream Object Structure

interface Stream {
    id: string;        // Unique identifier for the stream
    streamNo: number;  // Stream number/index
    language: string;  // Stream language (e.g., "English", "Spanish")
    hd: boolean;       // Whether the stream is in HD quality
    embedUrl: string;  // URL that can be used to embed the stream
    source: string;    // Source identifier (e.g., "alpha", "bravo")
}

Usage Example

// First, get match data to find available sources
fetch('https://livesport.su/api/matches/live')
  .then(response => response.json())
  .then(matches => {
    if (!matches.length) {
      throw new Error('No matches found');
    }
    // Get the first match
    const match = matches[0];
    console.log(`Found match: ${match.title}`);
      
    return fetch(`https://livesport.su/api/matches/${match.id}/detail`);
  })
  .then(response => response.json())
  .then(detail => {
    detail.sources.forEach(stream => {
      console.log(`Stream #${stream.streamNo}: ${stream.language} (${stream.hd ? 'HD' : 'SD'})`);
      console.log(`Embed URL: ${stream.embedUrl}`);
      
      // Here you would typically use the embedUrl to display the stream
      // For example, in an iframe:
      // document.getElementById('player').src = stream.embedUrl;
    });
  })
  .catch(error => console.error('Error:', error));

← Back to API Documentation