Overview

The live transcript dataset access allows you to access live text transcripts from events. The dataset is updated in real-time as new transcripts become available.

How it works

Our API provides support for live transcript streaming using JSON Lines (jsonl) format. When making a live transcript request, the API returns a URL that streams live transcript data in jsonl format. Each line in the jsonl file represents a timestamped snippet of the transcript, which updates continuously as the event progresses.

Clients can use this URL to receive live transcript data with minimal latency. Each line contains a small text segment with timing data, automatically updating to reflect the latest spoken content. This ensures that the transcript stays synchronized with the live broadcast.

How to access the data

The API allows you to query the live transcript dataset using a variety of parameters, such as ticker, ISIN, and date and more. You can also use the API to retrieve a list of all live transcripts available in the dataset. For more information on how to use the API, see the API reference.

If you have a subscription to both the audio and transcript live datasets, you can retrieve both the Live Audio and transcript data simultaneously using the Live endpoints.

The data is served through a global CDN, ensuring low latency and high availability. The URL is unique to each live transcript stream and customer. It should not be shared with others or altered in any way as it may result in a loss of access.

API Reference

Explore the Live Transcripts API endpoints.

Example

Below is an example of how to consume a live transcript. The same example is also available at CodePen. Just make sure to replace the transcriptUrl with your own.

html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Live Transcript</title>
    <style>
      #transcript {
        font-family: Arial, sans-serif;
        font-size: 16px;
        line-height: 1.5;
      }
      .paragraph {
        margin-bottom: 1em;
      }
    </style>
  </head>
  <body>
    <h1>Live Transcript</h1>
    <div id="transcript"></div>

    <script>
      document.addEventListener('DOMContentLoaded', () => {
        const transcriptUrl = 'your-transcript.jsonl'; // Replace with your transcript URL
        const transcriptElement = document.getElementById('transcript');
        // First line is a metadata line, skip it
        let lastPosition = 1;
        let currentParagraphId = null;
        let currentParagraphElement = null;

        async function fetchNewTranscript() {
          try {
            const response = await fetch(transcriptUrl, {
              headers: { Range: `bytes=${lastPosition}-` },
              cache: 'no-cache',
            });

            if (response.ok) {
              const reader = response.body.getReader();
              const decoder = new TextDecoder('utf-8');
              let { value, done } = await reader.read();
              while (!done) {
                const chunk = decoder.decode(value, { stream: true });
                processTranscriptChunk(chunk);
                lastPosition += value.length;
                ({ value, done } = await reader.read());
              }
            } else {
              console.error('Failed to fetch transcript:', response.statusText);
            }
          } catch (error) {
            console.error('Error fetching transcript:', error);
          } finally {
            setTimeout(fetchNewTranscript, 2000); // Adjust the interval as needed
          }
        }

        function processTranscriptChunk(chunk) {
          const lines = chunk.trim().split('\n');
          lines.forEach((line) => {
            try {
              const json = JSON.parse(line);

              // Start a new paragraph if 'p' changes
              if (json.p !== currentParagraphId) {
                currentParagraphId = json.p;
                currentParagraphElement = document.createElement('div');
                currentParagraphElement.className = 'paragraph';
                transcriptElement.appendChild(currentParagraphElement);
              }

              // Append text to the current paragraph
              const textNode = document.createTextNode(json.t + ' ');
              currentParagraphElement.appendChild(textNode);
            } catch (e) {
              console.error('Error parsing JSON line:', e);
            }
          });
        }

        fetchNewTranscript();
      });
    </script>
  </body>
</html>

Was this page helpful?