[mildom] Remove proxy (#260)

Closes #251
Makes 2cff495997, ab406a1c0e, #252 obsolete

Authored by: fstirlitz
pull/273/head
Felix S 4 years ago committed by GitHub
parent 6efb071135
commit a471f21da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,18 +6,15 @@ from datetime import datetime
import itertools
import json
import re
import random
from .common import InfoExtractor
from ..utils import (
ExtractorError, std_headers,
std_headers,
update_url_query,
random_uuidv4,
try_get,
)
from ..compat import (
compat_urlparse,
compat_urllib_parse_urlencode,
compat_str,
)
@ -26,17 +23,6 @@ class MildomBaseIE(InfoExtractor):
_GUEST_ID = None
_DISPATCHER_CONFIG = None
# Proxies provided by @nao20010128nao
# See https://github.com/nao20010128nao/bookish-octo-barnacle
_MILDOM_PROXY_HOSTS = (
# 'bookish-octo-barnacle.vercel.app', # see https://github.com/yt-dlp/yt-dlp/issues/251
'free-mountain-goal.glitch.me',
'lesmih0sted.f5.si',
)
def _mildom_proxy_host(self):
return random.choice(self._MILDOM_PROXY_HOSTS)
def _call_api(self, url, video_id, query={}, note='Downloading JSON metadata', init=False):
url = update_url_query(url, self._common_queries(query, init=init))
return self._download_json(url, video_id, note=note)['body']
@ -60,7 +46,6 @@ class MildomBaseIE(InfoExtractor):
def _fetch_dispatcher_config(self):
if not self._DISPATCHER_CONFIG:
try:
tmp = self._download_json(
'https://disp.mildom.com/serverListV2', 'initialization',
note='Downloading dispatcher_config', data=json.dumps({
@ -79,10 +64,6 @@ class MildomBaseIE(InfoExtractor):
}).encode('utf8')).decode('utf8').replace('\n', ''),
}).encode('utf8'))
self._DISPATCHER_CONFIG = self._parse_json(base64.b64decode(tmp['data']), 'initialization')
except ExtractorError:
self._DISPATCHER_CONFIG = self._download_json(
'https://%s/api/mildom/dispatcher_config' % self._mildom_proxy_host(), 'initialization',
note='Downloading dispatcher_config fallback')
return self._DISPATCHER_CONFIG
@staticmethod
@ -118,9 +99,6 @@ class MildomIE(MildomBaseIE):
video_id = self._match_id(url)
url = 'https://www.mildom.com/%s' % video_id
self.to_screen(
'Live videos are downloaded using proxies based on "https://github.com/nao20010128nao/bookish-octo-barnacle"\n'
' %s If you do not trust these proxies, please refrain from downloading live %s videos ' % (' ' * len(self.IE_NAME), self.IE_NAME))
webpage = self._download_webpage(url, video_id)
enterstudio = self._call_api(
@ -163,12 +141,7 @@ class MildomIE(MildomBaseIE):
del stream_query['streamReqId'], stream_query['timestamp']
for fmt in formats:
parsed = compat_urlparse.urlparse(fmt['url'])
parsed = parsed._replace(
netloc=self._mildom_proxy_host(),
query=compat_urllib_parse_urlencode(stream_query, True),
path='/api/mildom' + parsed.path)
fmt['url'] = compat_urlparse.urlunparse(parsed)
fmt.setdefault('http_headers', {})['Referer'] = 'https://www.mildom.com/'
self._sort_formats(formats)
@ -235,21 +208,6 @@ class MildomVodIE(MildomBaseIE):
'ext': 'mp4'
})
r''' # Proxy is not needed for VODs
stream_query = self._common_queries({
'is_lhls': '0',
})
del stream_query['timestamp']
for fmt in formats:
parsed = compat_urlparse.urlparse(fmt['url'])
stream_query['path'] = parsed.path[5:]
parsed = parsed._replace(
netloc=self._mildom_proxy_host(),
query=compat_urllib_parse_urlencode(stream_query, True),
path='/api/mildom/vod2/proxy')
fmt['url'] = compat_urlparse.urlunparse(parsed)
'''
self._sort_formats(formats)
return {

Loading…
Cancel
Save