[ie/crunchyroll] Always make metadata available (#9772)

Closes #9750
Authored by: bashonly
This commit is contained in:
bashonly 2024-05-04 11:15:44 -05:00 committed by GitHub
parent 231c2eacc4
commit cb2fb4a643
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -394,9 +394,10 @@ def entries():
if not self._IS_PREMIUM and traverse_obj(response, (f'{object_type}_metadata', 'is_premium_only')): if not self._IS_PREMIUM and traverse_obj(response, (f'{object_type}_metadata', 'is_premium_only')):
message = f'This {object_type} is for premium members only' message = f'This {object_type} is for premium members only'
if CrunchyrollBaseIE._REFRESH_TOKEN: if CrunchyrollBaseIE._REFRESH_TOKEN:
raise ExtractorError(message, expected=True) self.raise_no_formats(message, expected=True, video_id=internal_id)
self.raise_login_required(message, method='password') else:
self.raise_login_required(message, method='password', metadata_available=True)
else:
result['formats'], result['subtitles'] = self._extract_stream(internal_id) result['formats'], result['subtitles'] = self._extract_stream(internal_id)
result['chapters'] = self._extract_chapters(internal_id) result['chapters'] = self._extract_chapters(internal_id)
@ -583,13 +584,15 @@ def _real_extract(self, url):
if not response: if not response:
raise ExtractorError(f'No video with id {internal_id} could be found (possibly region locked?)', expected=True) raise ExtractorError(f'No video with id {internal_id} could be found (possibly region locked?)', expected=True)
result = self._transform_music_response(response)
if not self._IS_PREMIUM and response.get('isPremiumOnly'): if not self._IS_PREMIUM and response.get('isPremiumOnly'):
message = f'This {response.get("type") or "media"} is for premium members only' message = f'This {response.get("type") or "media"} is for premium members only'
if CrunchyrollBaseIE._REFRESH_TOKEN: if CrunchyrollBaseIE._REFRESH_TOKEN:
raise ExtractorError(message, expected=True) self.raise_no_formats(message, expected=True, video_id=internal_id)
self.raise_login_required(message, method='password') else:
self.raise_login_required(message, method='password', metadata_available=True)
result = self._transform_music_response(response) else:
result['formats'], _ = self._extract_stream(f'music/{internal_id}', internal_id) result['formats'], _ = self._extract_stream(f'music/{internal_id}', internal_id)
return result return result