A feature-rich command-line audio/video downloader
[ie/TVer] Support --ignore-no-formats-error when geo-blocked (#13598)
Abdulmohsen121647705a2f
diff --git a/yt_dlp/extractor/tver.py b/yt_dlp/extractor/tver.pyindex 3b6a0390af..a3dbabfd1e 100644--- a/yt_dlp/extractor/tver.py+++ b/yt_dlp/extractor/tver.py@@ -3,6 +3,7 @@ import datetime as dtfrom .streaks import StreaksBaseIEfrom ..utils import (ExtractorError,+ GeoRestrictedError,int_or_none,join_nonempty,make_archive_id,@@ -226,19 +227,26 @@ class TVerIE(StreaksBaseIE):'_type': 'url_transparent','url': smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % (account_id, brightcove_id),- {'geo_countries': ['JP']}),+ {'geo_countries': self._GEO_COUNTRIES}),'ie_key': 'BrightcoveNew',}project_id = video_info['streaks']['projectID']key_idx = dt.datetime.fromtimestamp(time_seconds(hours=9), dt.timezone.utc).month % 6 or 6- return {- **self._extract_from_streaks_api(project_id, streaks_id, {+ try:+ streaks_info = self._extract_from_streaks_api(project_id, streaks_id, {'Origin': 'https://tver.jp','Referer': 'https://tver.jp/','X-Streaks-Api-Key': self._STREAKS_API_INFO[project_id]['api_key'][f'key0{key_idx}'],- }),+ })+ except GeoRestrictedError as e:+ # Catch and re-raise with metadata_available to support --ignore-no-formats-error+ self.raise_geo_restricted(e.orig_msg, countries=self._GEO_COUNTRIES, metadata_available=True)+ streaks_info = {}++ return {+ **streaks_info,**metadata,'id': video_id,'_old_archive_ids': [make_archive_id('BrightcoveNew', brightcove_id)] if brightcove_id else None,