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

Code before:
            'appId': 'be4d79eb8fc7bd008ee82c8ec4ff6fd4',
            'language': 'en',
            'os': self._CLIENT_PLATFORM,
            'platform': self._CLIENT_PLATFORM,
            'wpf': 'pc',
        })
        for retry in (False, True):
            wmsgpad = int(time.time() * 1000)
            wmd = base64.b64encode(hmac.HMAC(
                self._SIGNING_KEY, f'{api_path[:255]}{wmsgpad}'.encode(),
                digestmod=hashlib.sha1).digest()).decode()

            try:
                return self._download_json(
                    f'https://global.apis.naver.com/weverse/wevweb{api_path}', video_id, note=note,
                    data=data, headers={
                        **self._API_HEADERS,
                        **self._get_authorization_header(),
                        **({'Content-Type': 'application/json'} if data else {}),
                        'WEV-device-Id': self._device_id,
                    }, query={
                        'wmsgpad': wmsgpad,
                        'wmd': wmd,
                    })
            except ExtractorError as e:
                if retry or not isinstance(e.cause, HTTPError):
                    raise
                elif self._is_logged_in and e.cause.status == 401:
                    self._refresh_access_token()
                    continue
                elif e.cause.status == 403:
                    if self._is_logged_in:
                        raise ExtractorError(
                            'Your account does not have access to this content', expected=True)
                    self._report_login_error('login_required')
                raise

    def _call_post_api(self, video_id):
        path = '' if self._is_logged_in else '/preview'
        return self._call_api(f'/post/v1.0/post-{video_id}{path}?fieldSet=postV1', video_id)

    def _get_community_id(self, channel):
        return str(self._call_api(
            f'/community/v1.0/communityIdUrlPathByUrlPathArtistCode?keyword={channel}',
            channel, note='Fetching community ID')['communityId'])

    def _get_formats(self, data, video_id):
        formats = traverse_obj(data, ('videos', 'list', lambda _, v: url_or_none(v['source']), {
            'url': 'source',
            'width': ('encodingOption', 'width', {int_or_none}),
            'height': ('encodingOption', 'height', {int_or_none}),

Review comment (suggestion):
```suggestion
                if is_retry or not isinstance(e.cause, HTTPError):
```

Code after:
            'appId': 'be4d79eb8fc7bd008ee82c8ec4ff6fd4',
            'language': 'en',
            'os': self._CLIENT_PLATFORM,
            'platform': self._CLIENT_PLATFORM,
            'wpf': 'pc',
        })
        for is_retry in (False, True):
            wmsgpad = int(time.time() * 1000)
            wmd = base64.b64encode(hmac.HMAC(
                self._SIGNING_KEY, f'{api_path[:255]}{wmsgpad}'.encode(),
                digestmod=hashlib.sha1).digest()).decode()

            try:
                return self._download_json(
                    f'https://global.apis.naver.com/weverse/wevweb{api_path}', video_id, note=note,
                    data=data, headers={
                        **self._API_HEADERS,
                        **self._get_authorization_header(),
                        **({'Content-Type': 'application/json'} if data else {}),
                        'WEV-device-Id': self._device_id,
                    }, query={
                        'wmsgpad': wmsgpad,
                        'wmd': wmd,
                    })
            except ExtractorError as e:
                if is_retry or not isinstance(e.cause, HTTPError):
                    raise
                elif self._is_logged_in and e.cause.status == 401:
                    self._refresh_access_token()
                    continue
                elif e.cause.status == 403:
                    if self._is_logged_in:
                        raise ExtractorError(
                            'Your account does not have access to this content', expected=True)
                    self._report_login_error('login_required')
                raise

    def _call_post_api(self, video_id):
        path = '' if self._is_logged_in else '/preview'
        return self._call_api(f'/post/v1.0/post-{video_id}{path}?fieldSet=postV1', video_id)

    def _get_community_id(self, channel):
        return str(self._call_api(
            f'/community/v1.0/communityIdUrlPathByUrlPathArtistCode?keyword={channel}',
            channel, note='Fetching community ID')['communityId'])

    def _get_formats(self, data, video_id):
        formats = traverse_obj(data, ('videos', 'list', lambda _, v: url_or_none(v['source']), {
            'url': 'source',
            'width': ('encodingOption', 'width', {int_or_none}),
            'height': ('encodingOption', 'height', {int_or_none}),