mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-14 07:12:41 +00:00
parent
d0491a1ebe
commit
2cff495997
1 changed files with 17 additions and 5 deletions
|
@ -1,11 +1,12 @@
|
|||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import base64
|
||||
from datetime import datetime
|
||||
import itertools
|
||||
import json
|
||||
import base64
|
||||
import re
|
||||
import random
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
|
@ -25,6 +26,17 @@ 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']
|
||||
|
@ -69,7 +81,7 @@ class MildomBaseIE(InfoExtractor):
|
|||
self._DISPATCHER_CONFIG = self._parse_json(base64.b64decode(tmp['data']), 'initialization')
|
||||
except ExtractorError:
|
||||
self._DISPATCHER_CONFIG = self._download_json(
|
||||
'https://bookish-octo-barnacle.vercel.app/api/mildom/dispatcher_config', 'initialization',
|
||||
'https://%s/api/mildom/dispatcher_config' % self._mildom_proxy_host(), 'initialization',
|
||||
note='Downloading dispatcher_config fallback')
|
||||
return self._DISPATCHER_CONFIG
|
||||
|
||||
|
@ -145,12 +157,12 @@ class MildomIE(MildomBaseIE):
|
|||
'Referer': 'https://www.mildom.com/',
|
||||
'Origin': 'https://www.mildom.com',
|
||||
}, note='Downloading m3u8 information')
|
||||
|
||||
del stream_query['streamReqId'], stream_query['timestamp']
|
||||
for fmt in formats:
|
||||
# Uses https://github.com/nao20010128nao/bookish-octo-barnacle by @nao20010128nao as a proxy
|
||||
parsed = compat_urlparse.urlparse(fmt['url'])
|
||||
parsed = parsed._replace(
|
||||
netloc='bookish-octo-barnacle.vercel.app',
|
||||
netloc=self._mildom_proxy_host(),
|
||||
query=compat_urllib_parse_urlencode(stream_query, True),
|
||||
path='/api/mildom' + parsed.path)
|
||||
fmt['url'] = compat_urlparse.urlunparse(parsed)
|
||||
|
@ -229,7 +241,7 @@ class MildomVodIE(MildomBaseIE):
|
|||
parsed = compat_urlparse.urlparse(fmt['url'])
|
||||
stream_query['path'] = parsed.path[5:]
|
||||
parsed = parsed._replace(
|
||||
netloc='bookish-octo-barnacle.vercel.app',
|
||||
netloc=self._mildom_proxy_host(),
|
||||
query=compat_urllib_parse_urlencode(stream_query, True),
|
||||
path='/api/mildom/vod2/proxy')
|
||||
fmt['url'] = compat_urlparse.urlunparse(parsed)
|
||||
|
|
Loading…
Reference in a new issue