Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/sejmpl.py (Python)

Code before:
        # despite it says "transmisje_arch", it works for live streams too!
        data = self._download_json(
            f'https://www.sejm.gov.pl/Sejm{term}.nsf/transmisje_arch.xsp/json/{video_id}',
            video_id)
        params = data['params']

        title = data['title'].strip()

        if data.get('status') == 'VIDEO_ENDED':
            live_status = 'was_live'
        elif data.get('status') == 'VIDEO_PLAYING':
            live_status = 'is_live'
        else:
            live_status = None
            self.report_warning(f'unknown status: {data.get("status")}')

        start_time = rfc3339_to_atende(params['start'])
        # current streams have a stop time of *expected* end of session, but actual times
        # can change during the transmission. setting a stop_time would artificially
        # end the stream at that time, while the session actually keeps going.
        if live_status == 'was_live':
            stop_time = rfc3339_to_atende(params['stop'])
        else:
            stop_time = None

        duration = (stop_time - start_time) // 1000 if stop_time else None

        entries = []

        def add_entry(file, legacy_file=False):
            if not file:
                return
            file = f'https:{file}' if file.startswith('//') else file
            if not legacy_file:
                file = update_url_query(file, {'startTime': start_time})
                if stop_time is not None:
                    file = update_url_query(file, {'stopTime': stop_time})
                stream_id = self._search_regex(r'/o2/sejm/([^/]+)/[^./]+\.livx', file, 'stream id')
            common_info = {
                'url': file,
                'duration': duration,
            }
            if legacy_file:
                entries.append({
                    **common_info,
                    'id': video_id,
                    'title': title,
                })
            else:
                entries.append({
                    **common_info,

Review comment (suggestion):
```suggestion
        if live_status == 'was_live':
            stop_time = rfc3339_to_atende(params['stop'])
            duration = (stop_time - start_time) // 1000
        else:
            stop_time, duration = None, None
```

Code after:
            video_id)
        # despite it says "transmisje_arch", it works for live streams too!
        data = self._download_json(
            f'https://www.sejm.gov.pl/Sejm{term}.nsf/transmisje_arch.xsp/json/{video_id}',
            video_id)
        params = data['params']

        title = strip_or_none(data.get('title'))

        if data.get('status') == 'VIDEO_ENDED':
            live_status = 'was_live'
        elif data.get('status') == 'VIDEO_PLAYING':
            live_status = 'is_live'
        else:
            live_status = None
            self.report_warning(f'unknown status: {data.get("status")}')

        start_time = rfc3339_to_atende(params['start'])
        # current streams have a stop time of *expected* end of session, but actual times
        # can change during the transmission. setting a stop_time would artificially
        # end the stream at that time, while the session actually keeps going.
        if live_status == 'was_live':
            stop_time = rfc3339_to_atende(params['stop'])
            duration = (stop_time - start_time) // 1000
        else:
            stop_time, duration = None, None

        entries = []

        def add_entry(file, legacy_file=False):
            if not file:
                return
            file = self._proto_relative_url(file)
            if not legacy_file:
                file = update_url_query(file, {'startTime': start_time})
                if stop_time is not None:
                    file = update_url_query(file, {'stopTime': stop_time})
                stream_id = self._search_regex(r'/o2/sejm/([^/]+)/[^./]+\.livx', file, 'stream id')
            common_info = {
                'url': file,
                'duration': duration,
            }
            if legacy_file:
                entries.append({
                    **common_info,
                    'id': video_id,
                    'title': title,
                })
            else:
                entries.append({
                    **common_info,