[goodgame] Fix format preference, Source by default
This commit is contained in:
parent
9ff9c9489d
commit
f044e0d631
@ -3,9 +3,12 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .youtube import YoutubeIE
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import ExtractorError, int_or_none
|
from .youtube import YoutubeIE
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
int_or_none
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class GoodgameBaseIE(InfoExtractor):
|
class GoodgameBaseIE(InfoExtractor):
|
||||||
@ -13,10 +16,10 @@ class GoodgameBaseIE(InfoExtractor):
|
|||||||
_API_BASE = 'https://goodgame.ru/api'
|
_API_BASE = 'https://goodgame.ru/api'
|
||||||
_HLS_BASE = 'https://hls.goodgame.ru/hls'
|
_HLS_BASE = 'https://hls.goodgame.ru/hls'
|
||||||
_QUALITIES = {
|
_QUALITIES = {
|
||||||
|
'Source': '',
|
||||||
'240p': '_240',
|
'240p': '_240',
|
||||||
'480p': '_480',
|
'480p': '_480',
|
||||||
'720p': '_720',
|
'720p': '_720',
|
||||||
'Source': ''
|
|
||||||
}
|
}
|
||||||
_RE_UPLOADER = r'''(?x)
|
_RE_UPLOADER = r'''(?x)
|
||||||
<a[^>]+
|
<a[^>]+
|
||||||
@ -103,6 +106,7 @@ class GoodgameStreamIE(GoodgameBaseIE):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'protocol': 'm3u8'
|
'protocol': 'm3u8'
|
||||||
})
|
})
|
||||||
|
self._prefer_source(formats)
|
||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': stream_info.get('title'),
|
'title': stream_info.get('title'),
|
||||||
@ -112,6 +116,14 @@ class GoodgameStreamIE(GoodgameBaseIE):
|
|||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _prefer_source(self, formats):
|
||||||
|
try:
|
||||||
|
source = next(f for f in formats if f['format_id'] == 'Source')
|
||||||
|
source['preference'] = 10
|
||||||
|
except StopIteration:
|
||||||
|
pass
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
|
||||||
class GoodgameVideoIE(GoodgameBaseIE):
|
class GoodgameVideoIE(GoodgameBaseIE):
|
||||||
IE_NAME = 'goodgame:video'
|
IE_NAME = 'goodgame:video'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user