mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-08 05:28:30 +00:00
[ie/TVer] Support --ignore-no-formats-error when geo-blocked (#13598)
Authored by: arabcoders
This commit is contained in:
parent
70d7687487
commit
121647705a
@ -3,6 +3,7 @@
|
||||
from .streaks import StreaksBaseIE
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
GeoRestrictedError,
|
||||
int_or_none,
|
||||
join_nonempty,
|
||||
make_archive_id,
|
||||
@ -226,19 +227,26 @@ def _real_extract(self, url):
|
||||
'_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,
|
||||
|
Loading…
Reference in New Issue
Block a user