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

Code before:
        }
    }]

    def _get_formats_and_subtitle(self, json_data, video_id):
        formats, subtitles = [], {}
        for source in traverse_obj(json_data, 'sources', 'sources_desktop', ...):
            ext = determine_ext(source.get('src'))
            if ext == 'm3u8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(source.get('src'), video_id)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            else:
                formats.append({'url': source.get('src'), 'ext': 'mp4'})
        return formats, subtitles

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        nextjs_json = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['initialState']['videos'][display_id]
        if nextjs_json.get('youtube_id'):
            return self.url_result(
                f'https://www.youtube.com/watch?v={nextjs_json.get("youtube_id")}', YoutubeIE)
        formats, subtitles = self._get_formats_and_subtitle(nextjs_json, display_id)

        return {
            'id': display_id,
            'title': nextjs_json.get('title') or self._html_search_meta('og:title', webpage),
            'formats': formats,
            'subtitles': subtitles,
            'description': nextjs_json.get('description') if nextjs_json.get('description') else None,
            'duration': int_or_none(nextjs_json.get('duration')),
            'thumbnails': [{'url': thumbnail} for thumbnail in nextjs_json.get('default_thumbnails')],
            'channel_id': nextjs_json.get('channel') or nextjs_json.get('channel_slug'),
            'timestamp': parse_iso8601(nextjs_json.get('created')),
            'release_timestamp': parse_iso8601(nextjs_json.get('published')),
            'view_count': int_or_none(nextjs_json.get('views')),
        }


Review comment (suggestion):
```suggestion

        formats, subtitles = self._get_formats_and_subtitle(nextjs_json, display_id)
        return {
```

Code after:
            'categories': ['News & Politics'],
            'live_status': 'not_live',
            'playable_in_embed': True,
            'channel': 'Newsflare',
            'duration': 37,
            'upload_date': '20180511',
        }
    }]

    def _get_formats_and_subtitle(self, json_data, video_id):
        formats, subtitles = [], {}
        for source in traverse_obj(json_data, 'sources', 'sources_desktop', ...):
            ext = determine_ext(source.get('src'), mimetype2ext(source.get('type')))
            if ext == 'm3u8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(source.get('src'), video_id)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            else:
                formats.append({'url': source.get('src'), 'ext': ext})
        return formats, subtitles

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        nextjs_json = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['initialState']['videos'][display_id]
        if nextjs_json.get('youtube_id'):
            return self.url_result(
                f'https://www.youtube.com/watch?v={nextjs_json.get("youtube_id")}', YoutubeIE)

        formats, subtitles = self._get_formats_and_subtitle(nextjs_json, display_id)
        return {
            'id': display_id,
            'title': nextjs_json.get('title') or self._html_search_meta('og:title', webpage),
            'formats': formats,
            'subtitles': subtitles,
            'description': nextjs_json.get('description') or None,
            'duration': int_or_none(nextjs_json.get('duration')),
            'thumbnails': [
                {'url': thumbnail}
                for thumbnail in traverse_obj(nextjs_json, ('default_thumbnails', ...))],
            'channel_id': traverse_obj(nextjs_json, 'channel', 'channel_slug'),
            'timestamp': parse_iso8601(nextjs_json.get('created')),
            'release_timestamp': parse_iso8601(nextjs_json.get('published')),
            'view_count': int_or_none(nextjs_json.get('views')),
        }