mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-08 13:38:29 +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 .streaks import StreaksBaseIE
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
GeoRestrictedError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
join_nonempty,
|
join_nonempty,
|
||||||
make_archive_id,
|
make_archive_id,
|
||||||
@ -226,19 +227,26 @@ def _real_extract(self, url):
|
|||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'url': smuggle_url(
|
'url': smuggle_url(
|
||||||
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, brightcove_id),
|
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, brightcove_id),
|
||||||
{'geo_countries': ['JP']}),
|
{'geo_countries': self._GEO_COUNTRIES}),
|
||||||
'ie_key': 'BrightcoveNew',
|
'ie_key': 'BrightcoveNew',
|
||||||
}
|
}
|
||||||
|
|
||||||
project_id = video_info['streaks']['projectID']
|
project_id = video_info['streaks']['projectID']
|
||||||
key_idx = dt.datetime.fromtimestamp(time_seconds(hours=9), dt.timezone.utc).month % 6 or 6
|
key_idx = dt.datetime.fromtimestamp(time_seconds(hours=9), dt.timezone.utc).month % 6 or 6
|
||||||
|
|
||||||
return {
|
try:
|
||||||
**self._extract_from_streaks_api(project_id, streaks_id, {
|
streaks_info = self._extract_from_streaks_api(project_id, streaks_id, {
|
||||||
'Origin': 'https://tver.jp',
|
'Origin': 'https://tver.jp',
|
||||||
'Referer': 'https://tver.jp/',
|
'Referer': 'https://tver.jp/',
|
||||||
'X-Streaks-Api-Key': self._STREAKS_API_INFO[project_id]['api_key'][f'key0{key_idx}'],
|
'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,
|
**metadata,
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'_old_archive_ids': [make_archive_id('BrightcoveNew', brightcove_id)] if brightcove_id else None,
|
'_old_archive_ids': [make_archive_id('BrightcoveNew', brightcove_id)] if brightcove_id else None,
|
||||||
|
Loading…
Reference in New Issue
Block a user