1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

Fix test, updates based on review.

This commit is contained in:
rli99 2020-10-08 17:42:51 +11:00
parent 0ca9dbd49b
commit 114f514efb

View File

@ -10,41 +10,41 @@ from ..utils import try_get
class MildomIE(InfoExtractor): class MildomIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mildom\.com/playback/(?P<channel>[0-9]+)\?v_id=(?P<id>[-0-9]+)' _VALID_URL = r'https?://(?:www\.)?mildom\.com/playback/(?P<channel>[0-9]+)\?v_id=(?P<id>[-0-9]+)'
_VIDEO_INFO_BASE_URL = 'https://cloudac.mildom.com/nonolive/videocontent/playback/getPlaybackDetail' _VIDEO_INFO_BASE_URL = 'https://cloudac.mildom.com/nonolive/videocontent/playback/getPlaybackDetail?v_id=%s'
_TEST = { _TEST = {
'url': 'https://www.mildom.com/playback/10819667?v_id=10819667-1594032863', 'url': 'https://www.mildom.com/playback/10819667?v_id=10819667-1594032863',
'md5': 'bed067a7dff3492184bd06d6131dd8be', 'md5': 'bed067a7dff3492184bd06d6131dd8be',
'info_dict': { 'info_dict': {
'id': '10819667-1594032863', 'id': '10819667-1594032863',
'ext': 'mp4', 'ext': 'mp4',
'title': '月曜!雀荘ほめちぎり #1', 'title': '月曜!雀荘ほめちぎり #1 【麻雀】',
'thumbnail': r're:^https?://.*\.png$', 'thumbnail': r're:^https?://.*\.png$',
'description': '#1 記念すべき初回の出演者は声優の高木美佑さんとVtuber界の麻雀つよつよ先生こと千羽黒乃さん\nMildom公式番組『麻雀番組』毎週月曜に生放送\n麻雀アプリも使った視聴者対戦型麻雀バラエティ!', 'description': '#1 記念すべき初回の出演者は声優の高木美佑さんとVtuber界の麻雀つよつよ先生こと千羽黒乃さん\nMildom公式番組『麻雀番組』毎週月曜に生放送\n麻雀アプリも使った視聴者対戦型麻雀バラエティ!',
'uploader': '月曜!雀荘ほめちぎり' 'uploader': '月曜!雀荘ほめちぎり【麻雀】'
} }
} }
def _real_extract(self, url): def _real_extract(self, url):
channel_id, video_id = re.match(self._VALID_URL, url).groups() channel_id, video_id = re.match(self._VALID_URL, url).groups()
webpage = self._download_webpage(url, video_id)
video_data = self._download_json( video_data = self._download_json(
self._VIDEO_INFO_BASE_URL + '?v_id=%s' % video_id, video_id) self._VIDEO_INFO_BASE_URL % video_id, video_id)
playback_data = video_data['body']['playback'] playback_data = video_data['body']['playback']
video_url = playback_data['source_url'] video_url = playback_data['source_url']
description = playback_data.get('video_intro') description = playback_data.get('video_intro')
uploader = try_get(playback_data, lambda x: x['author_info']['login_name'], compat_str) uploader = try_get(playback_data, lambda x: x['author_info']['login_name'], compat_str)
title = playback_data.get('title') title = playback_data.get('title')
thumbnail = playback_data.get('video_pic')
if not title or not thumbnail:
webpage = self._download_webpage(url, video_id)
if not title: if not title:
title = self._html_search_meta( title = self._html_search_meta(
['og:description', 'description'], ['og:description', 'description'],
webpage, 'title', default=None) webpage, 'title', default=None)
thumbnail = playback_data.get('video_pic')
if not thumbnail: if not thumbnail:
thumbnail = self._html_search_meta( thumbnail = self._og_search_thumbnail(webpage, default=None)
'og:image',
webpage, 'thumbnail', default=None)
return { return {
'id': video_id, 'id': video_id,