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

Code before:
            lang, ext = self._search_regex(
                r'^subtitle_(?P<lang>[\w-]+)_(?P<ext>\w+)$', key, 'subtitle metadata',
                default=(None, None), group=('lang', 'ext'))
            if lang and ext:
                subtitles.setdefault(lang, []).append({
                    'ext': ext,
                    'url': initial_state_json[key]
                })
                subtitles[lang].append({
                    'ext': 'srt',
                    'url': f'{remove_end(initial_state_json[key], "vtt")}srt'
                })

        return {
            'id': display_id,
            'title': (initial_state_json.get('title') or initial_state_json.get('display_title')
                      or episode_json.get('name')),
            'description': initial_state_json.get('description') or episode_json.get('description'),
            'duration': initial_state_json.get('duration'),
            'thumbnail': traverse_obj(episode_json, ('image', 'url')),
            'timestamp': unified_timestamp(episode_json.get('dateCreated')),
            'formats': formats,
            'subtitles': subtitles,
            'episode_number': (int_or_none(initial_state_json.get('episode_no')
                               or initial_state_json.get('episodeno')
                               or episode_json.get('episodeNumber'))),
            'cast': traverse_obj(episode_json, ('actor', ..., 'name'), default=None),
            'age_limit': int_or_none(traverse_obj(
                self._AGE_RATINGS_MAPPER, (traverse_obj(initial_state_json, ('internal_age_rating')))))
        }


Review comment (suggestion):
```suggestion
            'episode_number': (traverse_obj(initial_state_json, 'episode_no', 'episodeno', expected_type=int_or_none)
                               or episode_json.get('episodeNumber')),
```

Code after:
                default=(None, None), group=('lang', 'ext'))
            if lang and ext:
                subtitles.setdefault(lang, []).append({
                    'ext': ext,
                    'url': url,
                })

                if ext == 'vtt':
                    subtitles[lang].append({
                        'ext': 'srt',
                        'url': f'{remove_end(initial_state[key], "vtt")}srt',
                    })

        episode = traverse_obj(list(filter(
            lambda x: x.get('@type') in ('TVEpisode', 'Movie'), self._yield_json_ld(webpage, display_id))), 0) or {}
        return {
            'id': display_id,
            'title': (traverse_obj(initial_state, 'title', 'display_title')
                      or episode.get('name')),
            'description': initial_state.get('description') or episode.get('description'),
            'duration': initial_state.get('duration'),
            'thumbnail': traverse_obj(episode, ('image', 'url')),
            'timestamp': unified_timestamp(episode.get('dateCreated')),
            'formats': formats,
            'subtitles': subtitles,
            'episode_number': (traverse_obj(initial_state, 'episode_no', 'episodeno', expected_type=int_or_none)
                               or int_or_none(episode.get('episodeNumber'))),
            'cast': traverse_obj(episode, ('actor', ..., 'name'), default=None),
            'age_limit': self._AGE_RATINGS_MAPPER.get(initial_state.get('internal_age_rating'))
        }