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

Code before:
from ..utils import (
    int_or_none,
    str_or_none,
    traverse_obj,
    urljoin
)


class ITProTVBaseIE(InfoExtractor):
    _ENDPOINTS = {
        'course': 'course?url={}&brand=00002560-0000-3fa9-0000-1d61000035f3',
        'episode': 'brand/00002560-0000-3fa9-0000-1d61000035f3/episode?url={}'
    }

    def _call_api(self, ep, item_id, webpage):
        return self._download_json(
            f'https://api.itpro.tv/api/urza/v3/consumer-web/{self._ENDPOINTS[ep].format(item_id)}',
            item_id, note=f'Fetching {ep} data API',
            headers={'Authorization': f'Bearer {self._fetch_jwt(webpage)}'})[ep]

    def _fetch_jwt(self, webpage):
        return self._search_regex(r'{"passedToken":"([\w-]+\.[\w-]+\.[\w-]+)",', webpage, 'jwt')

    def _check_if_logged_in(self, webpage):
        if re.match(r'{\s*member\s*:\s*null', webpage):
            raise self.raise_login_required()


class ITProTVIE(ITProTVBaseIE):
    _VALID_URL = r'https://app.itpro.tv/course/(?P<course>[\w-]+)/(?P<id>[\w-]+)'
    _TESTS = [{
        'url': 'https://app.itpro.tv/course/guided-tour/introductionitprotv',
        'md5': 'bca4a28c2667fd1a63052e71a94bb88c',
        'info_dict': {
            'id': 'introductionitprotv',
            'ext': 'mp4',
            'title': 'An Introduction to ITProTV 101',
            'thumbnail': 'https://itprotv-image-bucket.s3.amazonaws.com/getting-started/itprotv-101-introduction-PGM.11_39_56_02.Still001.png',
            'description': 'md5:b175c2c3061ce35a4dd33865b2c1da4e',
            'duration': 269,
            'series': 'ITProTV 101',
            'series_id': 'guided-tour',
            'availability': 'needs_auth',
            'chapter': 'ITProTV 101',
            'chapter_number': 1,
            'chapter_id': '5dbb3de426b46c0010b5d1b6'
        },
    },
        {
        'url': 'https://app.itpro.tv/course/beyond-tech/job-interview-tips',
        'md5': '101a299b98c47ccf4c67f9f0951defa8',

Review comment (suggestion):
```suggestion
            self.raise_login_required()
```

Code after:
from ..utils import (
    int_or_none,
    str_or_none,
    traverse_obj,
    urljoin
)


class ITProTVBaseIE(InfoExtractor):
    _ENDPOINTS = {
        'course': 'course?url={}&brand=00002560-0000-3fa9-0000-1d61000035f3',
        'episode': 'brand/00002560-0000-3fa9-0000-1d61000035f3/episode?url={}'
    }

    def _call_api(self, ep, item_id, webpage):
        return self._download_json(
            f'https://api.itpro.tv/api/urza/v3/consumer-web/{self._ENDPOINTS[ep].format(item_id)}',
            item_id, note=f'Fetching {ep} data API',
            headers={'Authorization': f'Bearer {self._fetch_jwt(webpage)}'})[ep]

    def _fetch_jwt(self, webpage):
        return self._search_regex(r'{"passedToken":"([\w-]+\.[\w-]+\.[\w-]+)",', webpage, 'jwt')

    def _check_if_logged_in(self, webpage):
        if re.match(r'{\s*member\s*:\s*null', webpage):
            self.raise_login_required()


class ITProTVIE(ITProTVBaseIE):
    _VALID_URL = r'https://app.itpro.tv/course/(?P<course>[\w-]+)/(?P<id>[\w-]+)'
    _TESTS = [{
        'url': 'https://app.itpro.tv/course/guided-tour/introductionitprotv',
        'md5': 'bca4a28c2667fd1a63052e71a94bb88c',
        'info_dict': {
            'id': 'introductionitprotv',
            'ext': 'mp4',
            'title': 'An Introduction to ITProTV 101',
            'thumbnail': 'https://itprotv-image-bucket.s3.amazonaws.com/getting-started/itprotv-101-introduction-PGM.11_39_56_02.Still001.png',
            'description': 'md5:b175c2c3061ce35a4dd33865b2c1da4e',
            'duration': 269,
            'series': 'ITProTV 101',
            'series_id': 'guided-tour',
            'availability': 'needs_auth',
            'chapter': 'ITProTV 101',
            'chapter_number': 1,
            'chapter_id': '5dbb3de426b46c0010b5d1b6'
        },
    },
        {
        'url': 'https://app.itpro.tv/course/beyond-tech/job-interview-tips',
        'md5': '101a299b98c47ccf4c67f9f0951defa8',