mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-18 03:08:31 +00:00
[Streaks/Tver] allow metadata extraction
This commit is contained in:
parent
f3008bc5f8
commit
0b313ecbab
@ -22,7 +22,7 @@ class StreaksBaseIE(InfoExtractor):
|
|||||||
_GEO_BYPASS = False
|
_GEO_BYPASS = False
|
||||||
_GEO_COUNTRIES = ['JP']
|
_GEO_COUNTRIES = ['JP']
|
||||||
|
|
||||||
def _extract_from_streaks_api(self, project_id, media_id, headers=None, query=None, ssai=False):
|
def _extract_from_streaks_api(self, project_id, media_id, headers=None, query=None, ssai=False, metadata_available=False):
|
||||||
try:
|
try:
|
||||||
response = self._download_json(
|
response = self._download_json(
|
||||||
self._API_URL_TEMPLATE.format('playback', project_id, media_id, ''),
|
self._API_URL_TEMPLATE.format('playback', project_id, media_id, ''),
|
||||||
@ -38,14 +38,16 @@ def _extract_from_streaks_api(self, project_id, media_id, headers=None, query=No
|
|||||||
message = traverse_obj(error, ('message', {str}))
|
message = traverse_obj(error, ('message', {str}))
|
||||||
code = traverse_obj(error, ('code', {str}))
|
code = traverse_obj(error, ('code', {str}))
|
||||||
if code == 'REQUEST_FAILED':
|
if code == 'REQUEST_FAILED':
|
||||||
self.raise_geo_restricted(message, countries=self._GEO_COUNTRIES)
|
self.raise_geo_restricted(message, countries=self._GEO_COUNTRIES, metadata_available=metadata_available)
|
||||||
|
response = {}
|
||||||
elif code == 'MEDIA_NOT_FOUND':
|
elif code == 'MEDIA_NOT_FOUND':
|
||||||
raise ExtractorError(message, expected=True)
|
raise ExtractorError(message, expected=True)
|
||||||
elif code or message:
|
elif code or message:
|
||||||
raise ExtractorError(join_nonempty(code, message, delim=': '))
|
raise ExtractorError(join_nonempty(code, message, delim=': '))
|
||||||
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
streaks_id = response['id']
|
streaks_id = response.get('id')
|
||||||
live_status = {
|
live_status = {
|
||||||
'clip': 'was_live',
|
'clip': 'was_live',
|
||||||
'file': 'not_live',
|
'file': 'not_live',
|
||||||
|
@ -219,7 +219,7 @@ 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',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +227,9 @@ def _real_extract(self, url):
|
|||||||
**self._extract_from_streaks_api(video_info['streaks']['projectID'], streaks_id, {
|
**self._extract_from_streaks_api(video_info['streaks']['projectID'], streaks_id, {
|
||||||
'Origin': 'https://tver.jp',
|
'Origin': 'https://tver.jp',
|
||||||
'Referer': 'https://tver.jp/',
|
'Referer': 'https://tver.jp/',
|
||||||
}),
|
}, metadata_available=True),
|
||||||
**metadata,
|
**metadata,
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
'geo_countries': self._GEO_COUNTRIES,
|
||||||
'_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