def _fetch_course(self):
    if self._have_basic:
        return
    auth = {}
    if (not self._cookies):
        auth = self._login(username=self._username, password=self._password)
    if ((not auth) and self._cookies):
        auth = self._login(cookies=self._cookies)
    if (auth.get('login') == 'successful'):
        logger.info(msg='Logged in successfully.', new_line=True)
        logger.info(msg='Downloading course information ..')
        self._info = self._real_extract(self._url, skip_hls_stream=self._skip_hls_stream)
        time.sleep(1)
        logger.success(msg='Downloaded course information .. ')
        access_token = self._info['access_token']
        self._id = self._info['course_id']
        self._title = self._info['course_title']
        self._chapters_count = self._info['total_chapters']
        self._total_lectures = self._info['total_lectures']
        self._chapters = [InternUdemyChapter(z, access_token=access_token) for z in self._info['chapters']]
        logger.info(msg='Trying to logout now...', new_line=True)
        if (not self._cookies):
            self._logout()
        logger.info(msg='Logged out successfully.', new_line=True)
        self._have_basic = True
    if (auth.get('login') == 'failed'):
        logger.error(msg='Failed to login ..\n')
        sys.exit(0)
def _fetch_course(self):
    if self._have_basic:
        return
    auth = {}
    if (not self._cookies):
        auth = self._login(username=self._username, password=self._password)
    if ((not auth) and self._cookies):
        auth = self._login(cookies=self._cookies)
    if (auth.get('login') == 'successful'):
        logger.info(msg='Logged in successfully.', new_line=True)
        logger.info(msg='Downloading course information ..')
        self._info = self._real_extract(self._url, skip_hls_stream=self._skip_hls_stream)
        time.sleep(1)
        logger.success(msg='Downloaded course information .. ')
        access_token = self._info['access_token']
        self._id = self._info['course_id']
        self._title = self._info['course_title']
        self._chapters_count = self._info['total_chapters']
        self._total_lectures = self._info['total_lectures']
        self._chapters = [InternUdemyChapter(z, access_token=access_token) for z in self._info['chapters']]
        logger.info(msg='Trying to logout now...', new_line=True)
        if (not self._cookies):
            self._logout()
        logger.info(msg='Logged out successfully.', new_line=True)
        self._have_basic = True
    if (auth.get('login') == 'failed'):
        logger.error(msg='Failed to login ..\n')
        sys.exit(0)