[mildom] Update extractor to comply with current proxy (#212)

Authored by nao20010128nao
This commit is contained in:
The Hatsune Daishi 2021-04-03 17:13:49 +09:00 committed by GitHub
parent 0481374e1d
commit 5d39972ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@
import itertools import itertools
import json import json
import base64 import base64
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
@ -68,7 +69,7 @@ def _fetch_dispatcher_config(self):
self._DISPATCHER_CONFIG = self._parse_json(base64.b64decode(tmp['data']), 'initialization') self._DISPATCHER_CONFIG = self._parse_json(base64.b64decode(tmp['data']), 'initialization')
except ExtractorError: except ExtractorError:
self._DISPATCHER_CONFIG = self._download_json( self._DISPATCHER_CONFIG = self._download_json(
'https://bookish-octo-barnacle.vercel.app/api/dispatcher_config', 'initialization', 'https://bookish-octo-barnacle.vercel.app/api/mildom/dispatcher_config', 'initialization',
note='Downloading dispatcher_config fallback') note='Downloading dispatcher_config fallback')
return self._DISPATCHER_CONFIG return self._DISPATCHER_CONFIG
@ -110,6 +111,7 @@ def _real_extract(self, url):
enterstudio = self._call_api( enterstudio = self._call_api(
'https://cloudac.mildom.com/nonolive/gappserv/live/enterstudio', video_id, 'https://cloudac.mildom.com/nonolive/gappserv/live/enterstudio', video_id,
note='Downloading live metadata', query={'user_id': video_id}) note='Downloading live metadata', query={'user_id': video_id})
result_video_id = enterstudio.get('log_id', video_id)
title = try_get( title = try_get(
enterstudio, ( enterstudio, (
@ -128,7 +130,7 @@ def _real_extract(self, url):
), compat_str) ), compat_str)
servers = self._call_api( servers = self._call_api(
'https://cloudac.mildom.com/nonolive/gappserv/live/liveserver', video_id, 'https://cloudac.mildom.com/nonolive/gappserv/live/liveserver', result_video_id,
note='Downloading live server list', query={ note='Downloading live server list', query={
'user_id': video_id, 'user_id': video_id,
'live_server_type': 'hls', 'live_server_type': 'hls',
@ -139,7 +141,7 @@ def _real_extract(self, url):
'is_lhls': '0', 'is_lhls': '0',
}) })
m3u8_url = update_url_query(servers['stream_server'] + '/%s_master.m3u8' % video_id, stream_query) m3u8_url = update_url_query(servers['stream_server'] + '/%s_master.m3u8' % video_id, stream_query)
formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', headers={ formats = self._extract_m3u8_formats(m3u8_url, result_video_id, 'mp4', headers={
'Referer': 'https://www.mildom.com/', 'Referer': 'https://www.mildom.com/',
'Origin': 'https://www.mildom.com', 'Origin': 'https://www.mildom.com',
}, note='Downloading m3u8 information') }, note='Downloading m3u8 information')
@ -150,13 +152,13 @@ def _real_extract(self, url):
parsed = parsed._replace( parsed = parsed._replace(
netloc='bookish-octo-barnacle.vercel.app', netloc='bookish-octo-barnacle.vercel.app',
query=compat_urllib_parse_urlencode(stream_query, True), query=compat_urllib_parse_urlencode(stream_query, True),
path='/api' + parsed.path) path='/api/mildom' + parsed.path)
fmt['url'] = compat_urlparse.urlunparse(parsed) fmt['url'] = compat_urlparse.urlunparse(parsed)
self._sort_formats(formats) self._sort_formats(formats)
return { return {
'id': video_id, 'id': result_video_id,
'title': title, 'title': title,
'description': description, 'description': description,
'uploader': uploader, 'uploader': uploader,
@ -172,9 +174,8 @@ class MildomVodIE(MildomBaseIE):
_VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/playback/(?P<user_id>\d+)/(?P<id>(?P=user_id)-[a-zA-Z0-9]+)' _VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/playback/(?P<user_id>\d+)/(?P<id>(?P=user_id)-[a-zA-Z0-9]+)'
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) m = re.match(self._VALID_URL, url)
m = self._VALID_URL_RE.match(url) user_id, video_id = m.group('user_id'), m.group('id')
user_id = m.group('user_id')
url = 'https://www.mildom.com/playback/%s/%s' % (user_id, video_id) url = 'https://www.mildom.com/playback/%s/%s' % (user_id, video_id)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
@ -230,7 +231,7 @@ def _real_extract(self, url):
parsed = parsed._replace( parsed = parsed._replace(
netloc='bookish-octo-barnacle.vercel.app', netloc='bookish-octo-barnacle.vercel.app',
query=compat_urllib_parse_urlencode(stream_query, True), query=compat_urllib_parse_urlencode(stream_query, True),
path='/api/vod2/proxy') path='/api/mildom/vod2/proxy')
fmt['url'] = compat_urlparse.urlunparse(parsed) fmt['url'] = compat_urlparse.urlunparse(parsed)
self._sort_formats(formats) self._sort_formats(formats)