Compare commits

..

No commits in common. "779f2e951f24660e419bfb0d7f0a84ecffb4fadf" and "cb63487ab49ad463e2a7a291f153c65d4e5a7625" have entirely different histories.

View File

@ -3,15 +3,13 @@ import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_strdate,
url_or_none,
)
class MBNIE(InfoExtractor):
IE_DESC = 'mbn.co.kr (매일방송)'
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/preview(?:list)?/\d+/\d+/(?P<id>\d+)'
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://mbn.co.kr/vod/programContents/previewlist/861/5433/1276155',
'md5': '85e1694e5b247c04d1386b7e3c90fd76',
@ -56,34 +54,29 @@ class MBNIE(InfoExtractor):
content_id = self._match_id(url)
webpage = self._download_webpage(url, content_id)
content_cls_cd = self._search_regex(
r'"\?content_cls_cd=(\d+)&', webpage, 'content cls cd', fatal=False) or '20'
content_cls_cd = self._search_regex(r'"\?content_cls_cd=(\d+)&', webpage, 'content_cls_cd', default='20')
media_info = self._download_json(
'https://www.mbn.co.kr/player/mbnVodPlayer_2020.mbn', content_id,
note='Fetching playback data', query={
'content_cls_cd': content_cls_cd,
'content_id': content_id,
'relay_type': '1',
})
f'https://www.mbn.co.kr/player/mbnVodPlayer_2020.mbn?content_cls_cd={content_cls_cd}&content_id={content_id}&relay_type=1',
content_id, note='Fetching playback data')
formats = []
for stream_url in traverse_obj(media_info, ('movie_list', ..., 'url')):
location = re.sub(r'/(?:chunk|play)list(?:_pd\d+)?\.m3u8', '/manifest.m3u8', stream_url)
m3u8_url = url_or_none(self._download_webpage(
for stream in media_info.get('movie_list'):
if not stream.get('url'):
continue
location = re.sub(r'/(?:chunklist|playlist)(?:_pd180000)?\.m3u8', '/manifest.m3u8', stream['url'])
m3u8_url = self._download_webpage(
f'https://www.mbn.co.kr/player/mbnStreamAuth_new_vod.mbn?vod_url={location}',
content_id, note='Fetching authenticated m3u8 url'))
content_id, note='Generating authenticated m3u8 url')
formats.extend(self._extract_m3u8_formats(m3u8_url, content_id, fatal=False))
formats.extend(self._extract_m3u8_formats(m3u8_url, content_id))
return {
'id': content_id,
**traverse_obj(media_info, {
'title': ('movie_title', {str}),
'duration': ('play_sec', {int_or_none}),
'release_date': ('bcast_date', {lambda x: x.replace('.', '')}, {unified_strdate}),
'thumbnail': ('movie_start_Img', {url_or_none}),
'series': ('prog_nm', {str}),
'episode_number': ('ad_contentnumber', {int_or_none}),
}),
'title': media_info.get('movie_title'),
'duration': int_or_none(media_info.get('play_sec')),
'release_date': unified_strdate(media_info.get('bcast_date').replace('.', '')),
'thumbnail': media_info.get('movie_start_Img'),
'series': media_info.get('prog_nm'),
'episode_number': int_or_none(media_info.get('ad_contentnumber')),
'formats': formats,
}