Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mildom] Add new extractor #25958

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@
- **Mgoon**
- **MGTV**: 芒果TV
- **MiaoPai**
- **Mildom**: mildom.com
- **MinistryGrid**
- **Minoto**
- **miomio.tv**
Expand Down
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@
MicrosoftVirtualAcademyIE,
MicrosoftVirtualAcademyCourseIE,
)
from .mildom import MildomIE
from .ministrygrid import MinistryGridIE
from .minoto import MinotoIE
from .miomio import MioMioIE
Expand Down
57 changes: 57 additions & 0 deletions youtube_dl/extractor/mildom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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<channel>[0-9]+)\?v_id=(?P<id>[-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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'title': '月曜!雀荘ほめちぎり #1',
'title': '月曜!雀荘ほめちぎり #1 【麻雀】',

(according to json)

'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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be done only if necessary to save one request?

video_data = self._download_json(
self._VIDEO_INFO_BASE_URL + '?v_id=%s' % video_id, video_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to directly include '?v_id=%s' in _VIDEO_INFO_BASE_URL.

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')
if not title:
title = self._html_search_meta(
['og:description', 'description'],
webpage, 'title', default=None)
thumbnail = playback_data.get('video_pic')
if not thumbnail:
thumbnail = self._html_search_meta(
'og:image',
webpage, 'thumbnail', default=None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use _og_search_thumbnail instead:

thumbnail = self._og_search_thumbnail(webpage, default=None)


return {
'id': video_id,
'title': title,
'url': video_url,
'uploader': uploader,
'channel_id': channel_id,
'thumbnail': thumbnail,
'description': description
}