From 9cbf7f15a9bddda8237886d90a45bcf33bc4301c Mon Sep 17 00:00:00 2001 From: rli99 Date: Sat, 11 Jul 2020 01:48:34 +1000 Subject: [PATCH] Add new extractor for Mildom. --- docs/supportedsites.md | 1 + youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/mildom.py | 53 ++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 youtube_dl/extractor/mildom.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 35c1050e5..49b133b93 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -483,6 +483,7 @@ - **Mgoon** - **MGTV**: 芒果TV - **MiaoPai** + - **Mildom**: mildom.com - **MinistryGrid** - **Minoto** - **miomio.tv** diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 4b3092028..d3a8b0071 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -623,6 +623,7 @@ from .microsoftvirtualacademy import ( MicrosoftVirtualAcademyIE, MicrosoftVirtualAcademyCourseIE, ) +from .mildom import MildomIE from .ministrygrid import MinistryGridIE from .minoto import MinotoIE from .miomio import MioMioIE diff --git a/youtube_dl/extractor/mildom.py b/youtube_dl/extractor/mildom.py new file mode 100644 index 000000000..a431ce2d3 --- /dev/null +++ b/youtube_dl/extractor/mildom.py @@ -0,0 +1,53 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..compat import compat_str +from ..utils import ( + try_get +) + + +class MildomIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?mildom\.com/playback/(?P[0-9]+)\?v_id=(?P[-0-9]+)' + _VIDEO_INFO_BASE_URL = 'https://cloudac.mildom.com/nonolive/videocontent/playback/getPlaybackDetail' + _TEST = { + 'url': 'https://www.mildom.com/playback/10819667?v_id=10819667-1594032863', + 'md5': 'bed067a7dff3492184bd06d6131dd8be', + 'info_dict': { + 'id': '10819667-1594032863', + 'ext': 'mp4', + 'title': '月曜!雀荘ほめちぎり #1', + 'thumbnail': r're:^https?://.*\.png$', + 'description': '#1 記念すべき初回の出演者は声優の高木美佑さんとVtuber界の麻雀つよつよ先生こと千羽黒乃さん!\nMildom公式番組『麻雀番組』毎週月曜に生放送!\n麻雀アプリも使った視聴者対戦型麻雀バラエティ!', + 'uploader': '月曜!雀荘ほめちぎり' + } + } + + def _real_extract(self, url): + channel_id, video_id = re.match(self._VALID_URL, url).groups() + webpage = self._download_webpage(url, video_id) + thumbnail = self._html_search_meta( + 'og:image', + webpage, 'thumbnail', default=None) + + video_data = self._download_json( + self._VIDEO_INFO_BASE_URL + f'?v_id={video_id}', video_id) + playback_data = video_data['body']['playback'] + + video_url = playback_data['source_url'] + description = playback_data.get('video_intro') + uploader = try_get(playback_data, lambda x: x['author_info']['login_name'], compat_str) + title = playback_data.get('title') + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + 'uploader': uploader, + 'channel_id': channel_id, + 'thumbnail': thumbnail, + 'description': description + }