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

Code before:
    _API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'

    def _real_extract(self, url):
        video_id = self._match_id(url)
        api_data = self._download_json(self._API_URL % video_id, video_id)
        if not api_data:
            self.raise_no_formats('Failed to retrieve API data')

        if not api_data.get('wasSuccessful'):
            self.raise_no_formats('API request was not successful')

        video_details = api_data.get('videoDetails')
        if not video_details:
            self.raise_no_formats('No video details found')

        files_data = video_details.get('files')
        if not files_data:
            self.raise_no_formats('No files data found')

        file_info = files_data.get('file')
        if not file_info:
            self.raise_no_formats('No file information found')

        m3u8_url = file_info.get('url')
        if not m3u8_url:
            self.raise_no_formats('No M3U8 URL found')

        formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native')

        # Parse duration from duration string (format: "HH:MM:SS:FF")
        duration_str = file_info.get('duration')
        duration = None
        if duration_str:
            # Convert "HH:MM:SS:FF" to seconds (ignoring frames)
            try:
                time_parts = duration_str.split(':')
                if len(time_parts) >= 3:
                    hours = int(time_parts[0])
                    minutes = int(time_parts[1])
                    seconds = int(time_parts[2])
                    duration = hours * 3600 + minutes * 60 + seconds
            except (ValueError, IndexError):
                pass

        # Parse upload date from recordingFrom
        upload_date = None
        recording_from = video_details.get('recordingFrom')
        if recording_from:
            upload_date = unified_timestamp(recording_from)

        return {

Review comment (bug):
The m3u8 extraction will fail, or not, so let it do so:
```suggestion
        m3u8_url = traverse_obj(video_details, ('files', 'file', 'url', {str}))
```

Code after:
            'id': 'SV1394.dv',
            'ext': 'mp4',
            'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
            'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/CommitteeThumbnail06.jpg',
            'upload_date': '19960822',
            'duration': 14765,
            'timestamp': 840754200,
        },
        'params': {
            'skip_download': True,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        video_details = self._download_json(
            f'https://vodapi.aph.gov.au/api/search/parlview/{video_id}', video_id)['videoDetails']

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            video_details['files']['file']['url'], video_id, 'mp4')

        DURATION_RE = re.compile(r'(?P<duration>\d+:\d+:\d+):\d+')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(video_details, {
                'title': (('parlViewTitle', 'title'), {str}, any),
                'description': ('parlViewDescription', {str}),
                'duration': ('files', 'file', 'duration', {DURATION_RE.fullmatch}, 'duration', {parse_duration}),
                'timestamp': ('recordingFrom', {parse_iso8601}),
                'thumbnail': ('thumbUrl', {url_or_none}),
            }),
        }