1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-29 05:32:00 +00:00

[vvvvid] fix season metadata extraction(#18130)

This commit is contained in:
Remita Amine 2021-01-01 20:21:59 +01:00
parent d0d838638c
commit 75972e200d

View file

@ -25,7 +25,6 @@ class VVVVIDIE(InfoExtractor):
'duration': 239, 'duration': 239,
'series': '"Perché dovrei guardarlo?" di Dario Moccia', 'series': '"Perché dovrei guardarlo?" di Dario Moccia',
'season_id': '437', 'season_id': '437',
'season_number': 1,
'episode': 'Ping Pong', 'episode': 'Ping Pong',
'episode_number': 1, 'episode_number': 1,
'episode_id': '3334', 'episode_id': '3334',
@ -75,7 +74,6 @@ class VVVVIDIE(InfoExtractor):
def _extract_common_video_info(self, video_data): def _extract_common_video_info(self, video_data):
return { return {
'thumbnail': video_data.get('thumbnail'), 'thumbnail': video_data.get('thumbnail'),
'episode_number': int_or_none(video_data.get('number')),
'episode_id': str_or_none(video_data.get('id')), 'episode_id': str_or_none(video_data.get('id')),
} }
@ -145,6 +143,17 @@ class VVVVIDIE(InfoExtractor):
return d return d
info = {}
def metadata_from_url(r_url):
if not info and r_url:
mobj = re.search(r'_(?:S(\d+))?Ep(\d+)', r_url)
if mobj:
info['episode_number'] = int(mobj.group(2))
season_number = mobj.group(1)
if season_number:
info['season_number'] = int(season_number)
for quality in ('_sd', ''): for quality in ('_sd', ''):
embed_code = video_data.get('embed_info' + quality) embed_code = video_data.get('embed_info' + quality)
if not embed_code: if not embed_code:
@ -166,9 +175,12 @@ class VVVVIDIE(InfoExtractor):
else: else:
formats.extend(self._extract_wowza_formats( formats.extend(self._extract_wowza_formats(
'http://sb.top-ix.org/videomg/_definst_/mp4:%s/playlist.m3u8' % embed_code, video_id)) 'http://sb.top-ix.org/videomg/_definst_/mp4:%s/playlist.m3u8' % embed_code, video_id))
metadata_from_url(embed_code)
self._sort_formats(formats) self._sort_formats(formats)
info = self._extract_common_video_info(video_data) metadata_from_url(video_data.get('thumbnail'))
info.update(self._extract_common_video_info(video_data))
info.update({ info.update({
'id': video_id, 'id': video_id,
'title': title, 'title': title,
@ -176,7 +188,6 @@ class VVVVIDIE(InfoExtractor):
'duration': int_or_none(video_data.get('length')), 'duration': int_or_none(video_data.get('length')),
'series': video_data.get('show_title'), 'series': video_data.get('show_title'),
'season_id': season_id, 'season_id': season_id,
'season_number': video_data.get('season_number'),
'episode': title, 'episode': title,
'view_count': int_or_none(video_data.get('views')), 'view_count': int_or_none(video_data.get('views')),
'like_count': int_or_none(video_data.get('video_likes')), 'like_count': int_or_none(video_data.get('video_likes')),
@ -211,7 +222,6 @@ class VVVVIDShowIE(VVVVIDIE):
entries = [] entries = []
for season in (seasons or []): for season in (seasons or []):
season_number = int_or_none(season.get('number'))
episodes = season.get('episodes') or [] episodes = season.get('episodes') or []
for episode in episodes: for episode in episodes:
if episode.get('playable') is False: if episode.get('playable') is False:
@ -227,7 +237,6 @@ class VVVVIDShowIE(VVVVIDIE):
'url': '/'.join([base_url, season_id, video_id]), 'url': '/'.join([base_url, season_id, video_id]),
'title': episode.get('title'), 'title': episode.get('title'),
'description': episode.get('description'), 'description': episode.get('description'),
'season_number': season_number,
'season_id': season_id, 'season_id': season_id,
}) })
entries.append(info) entries.append(info)