mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-14 00:57:25 +08:00
[StreamMe]: flake8 checked
This commit is contained in:
parent
4666796c6c
commit
45a80c1b16
@ -10,6 +10,7 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class StreamMeIE(InfoExtractor):
|
class StreamMeIE(InfoExtractor):
|
||||||
IE_NAME = 'StreamMe:video'
|
IE_NAME = 'StreamMe:video'
|
||||||
_API_CHANNEL = 'https://www.stream.me/api-user/v1/<channel_id>/channel'
|
_API_CHANNEL = 'https://www.stream.me/api-user/v1/<channel_id>/channel'
|
||||||
@ -35,7 +36,6 @@ class StreamMeIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
apiurl = self._API_ARCHIVE.replace('<channel_id>', m.group('channel_id'))
|
apiurl = self._API_ARCHIVE.replace('<channel_id>', m.group('channel_id'))
|
||||||
|
|
||||||
# webpage = self._download_webpage(url, video_id)
|
|
||||||
data = json.loads(self._download_webpage(apiurl, video_id))
|
data = json.loads(self._download_webpage(apiurl, video_id))
|
||||||
|
|
||||||
for vod in data.get('_embedded').get('vod'):
|
for vod in data.get('_embedded').get('vod'):
|
||||||
@ -50,7 +50,6 @@ class StreamMeIE(InfoExtractor):
|
|||||||
.get('href'), video_id)
|
.get('href'), video_id)
|
||||||
|
|
||||||
formats = self._extract_formats(manifest_json.get('formats'))
|
formats = self._extract_formats(manifest_json.get('formats'))
|
||||||
|
|
||||||
self._sort_formats(formats, 'vbr')
|
self._sort_formats(formats, 'vbr')
|
||||||
info = self._extract_info(vod_info)
|
info = self._extract_info(vod_info)
|
||||||
info['formats'] = formats
|
info['formats'] = formats
|
||||||
@ -79,7 +78,8 @@ class StreamMeIE(InfoExtractor):
|
|||||||
formats = []
|
formats = []
|
||||||
for fmt_tag, d in fmts.items():
|
for fmt_tag, d in fmts.items():
|
||||||
# skip websocket and mjpeg we can't handle them anyway
|
# skip websocket and mjpeg we can't handle them anyway
|
||||||
if fmt_tag in ('mjpeg-lodef', 'mp4-ws',): continue
|
if fmt_tag in ('mjpeg-lodef', 'mp4-ws',):
|
||||||
|
continue
|
||||||
for fmt_info in d.get('encodings'):
|
for fmt_info in d.get('encodings'):
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': fmt_info.get('location'),
|
'url': fmt_info.get('location'),
|
||||||
@ -96,6 +96,7 @@ class StreamMeIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
|
|
||||||
class StreamMeLiveIE(StreamMeIE):
|
class StreamMeLiveIE(StreamMeIE):
|
||||||
IE_NAME = 'StreamIE:live'
|
IE_NAME = 'StreamIE:live'
|
||||||
_VALID_URL = r'%s/(?P<id>[^\#]+$)' % StreamMeIE._VALID_URL_BASE
|
_VALID_URL = r'%s/(?P<id>[^\#]+$)' % StreamMeIE._VALID_URL_BASE
|
||||||
@ -118,13 +119,14 @@ class StreamMeLiveIE(StreamMeIE):
|
|||||||
.get('_links')
|
.get('_links')
|
||||||
.get('manifest')
|
.get('manifest')
|
||||||
.get('href'), channel_id)
|
.get('href'), channel_id)
|
||||||
formats = self._extract_formats(manifest_json.get('formats'))
|
|
||||||
|
|
||||||
|
formats = self._extract_formats(manifest_json.get('formats'))
|
||||||
self._sort_formats(formats, 'vbr')
|
self._sort_formats(formats, 'vbr')
|
||||||
info = self._extract_info(stream_info)
|
info = self._extract_info(stream_info)
|
||||||
info['formats'] = formats
|
info['formats'] = formats
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
class StreamMeArchiveIE(StreamMeIE):
|
class StreamMeArchiveIE(StreamMeIE):
|
||||||
IE_NAME = 'StreamMe:archives'
|
IE_NAME = 'StreamMe:archives'
|
||||||
_VALID_URL = r'%s/(?P<id>[^\#]+(?P<tag>\#archives)$)' % StreamMeIE._VALID_URL_BASE
|
_VALID_URL = r'%s/(?P<id>[^\#]+(?P<tag>\#archives)$)' % StreamMeIE._VALID_URL_BASE
|
||||||
@ -137,13 +139,16 @@ class StreamMeArchiveIE(StreamMeIE):
|
|||||||
'title': 'KombatCup',
|
'title': 'KombatCup',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 25,
|
'playlist_mincount': 25,
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
channel_id = self._match_id(url).split('#')[0]
|
channel_id = self._match_id(url).split('#')[0]
|
||||||
apiurl = StreamMeIE._API_ARCHIVE.replace('<channel_id>', channel_id)
|
apiurl = StreamMeIE._API_ARCHIVE.replace('<channel_id>', channel_id)
|
||||||
# TODO: implement paginated downloading
|
# TODO: implement paginated downloading
|
||||||
data = json.loads(self._download_webpage(apiurl+'?limit=%d&offset=0' % self._PLAYLIST_LIMIT, channel_id))
|
data = json.loads(self._download_webpage(apiurl + '?limit=%d&offset=0' % self._PLAYLIST_LIMIT, channel_id))
|
||||||
playlist = []
|
playlist = []
|
||||||
|
|
||||||
for vod in data.get('_embedded').get('vod'):
|
for vod in data.get('_embedded').get('vod'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user