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

Code before:
    }]
    _API_HEADERS = {}

    def _perform_login(self, username, password):
        try:
            response = self._download_json(
                'https://api.gamedev.tv/api/students/login', None, 'Logging in',
                headers={'Content-Type': 'application/json'},
                data=json.dumps({
                    'email': username,
                    'password': password,
                    'cart_items': [],
                }).encode())
        except ExtractorError as e:
            if isinstance(e.cause, HTTPError) and e.cause.status == 401:
                raise ExtractorError('Invalid username/password', expected=True)
            raise

        self._API_HEADERS['Authorization'] = f'{response["token_type"]} {response["access_token"]}'

    def _real_initialize(self):
        if not self._API_HEADERS.get('Authorization'):
            self.raise_login_required(
                'This content is only available with purchase', method='password')

    def _entries(self, data, course_id, course_info):
        for section in traverse_obj(data, ('sections', ..., {dict})):
            section_info = traverse_obj(section, {
                'season_id': ('id', {str_or_none}),
                'season': ('title', {str}),
                'season_number': ('order', {int_or_none}),
            })
            for lecture in traverse_obj(section, ('lectures', lambda _, v: url_or_none(v['video']['playListUrl']))):
                display_id = join_nonempty(course_id, section_info.get('season_id'), lecture.get('id'))
                formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                    lecture['video']['playListUrl'], display_id, 'mp4', m3u8_id='hls')
                yield {
                    **course_info,
                    **section_info,
                    'id': display_id,  # fallback
                    'display_id': display_id,
                    'formats': formats,
                    'subtitles': subtitles,
                    'series': course_info.get('title'),
                    'series_id': course_id,
                    **traverse_obj(lecture, {
                        'id': ('video', 'guid', {str}),
                        'title': ('title', {str}),
                        'alt_title': ('video', 'title', {str}),
                        'description': ('description', {clean_html}),
                        'episode': ('title', {str}),

Review comment (suggestion):
```suggestion
    def _entries(self, data, course_id, course_info, lecture_id):
```

Code after:
    }, {
        'url': 'https://www.gamedev.tv/dashboard/courses/63/2279',
        'info_dict': {
            'id': 'df04f4d8-68a4-4756-a71b-9ca9446c3a01',
            'ext': 'mp4',
            'modified_timestamp': 1701695752,
            'upload_date': '20230504',
            'episode': 'MagicaVoxel Community Course Introduction',
            'series_id': '63',
            'title': 'MagicaVoxel Community Course Introduction',
            'timestamp': 1683195397,
            'modified_date': '20231204',
            'categories': ['3D Art', 'MagicaVoxel'],
            'season': 'MagicaVoxel Community Course',
            'tags': ['MagicaVoxel', 'all', 'course'],
            'series': 'MagicaVoxel 3D Art Mini Course',
            'duration': 1405,
            'episode_number': 1,
            'season_number': 1,
            'season_id': '219',
            'description': 'md5:a378738c5bbec1c785d76c067652d650',
            'display_id': '63-219-2279',
            'alt_title': '1_CC_MVX MagicaVoxel Community Course Introduction.mp4',
            'thumbnail': 'https://vz-23691c65-6fa.b-cdn.net/df04f4d8-68a4-4756-a71b-9ca9446c3a01/thumbnail.jpg',
        },
    }]
    _API_HEADERS = {}

    def _perform_login(self, username, password):
        try:
            response = self._download_json(
                'https://api.gamedev.tv/api/students/login', None, 'Logging in',
                headers={'Content-Type': 'application/json'},
                data=json.dumps({
                    'email': username,
                    'password': password,
                    'cart_items': [],
                }).encode())
        except ExtractorError as e:
            if isinstance(e.cause, HTTPError) and e.cause.status == 401:
                raise ExtractorError('Invalid username/password', expected=True)
            raise

        self._API_HEADERS['Authorization'] = f'{response["token_type"]} {response["access_token"]}'

    def _real_initialize(self):
        if not self._API_HEADERS.get('Authorization'):
            self.raise_login_required(
                'This content is only available with purchase', method='password')

    def _entries(self, data, course_id, course_info, selected_lecture):