[StreamMe] put some more checks & thumbnail tests
This commit is contained in:
parent
62c0e83bf5
commit
20910f945b
@ -25,6 +25,7 @@ class StreamMeIE(InfoExtractor):
|
|||||||
'uploader': 'KombatCup',
|
'uploader': 'KombatCup',
|
||||||
'uploader_id': 'kombatcup',
|
'uploader_id': 'kombatcup',
|
||||||
'timestamp': 1481512102000,
|
'timestamp': 1481512102000,
|
||||||
|
'thumbnail': 're:https?://.*.jpg$',
|
||||||
'age_limit': 13,
|
'age_limit': 13,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,23 +49,30 @@ class StreamMeIE(InfoExtractor):
|
|||||||
return info
|
return info
|
||||||
|
|
||||||
def _extract_info(self, info):
|
def _extract_info(self, info):
|
||||||
return {
|
data = {
|
||||||
'id': info.get('urlId') or info.get('publicId'),
|
'id': info.get('urlId') or info['publicId'],
|
||||||
# 'formats': self.formats,
|
# 'formats': self.formats,
|
||||||
'title': info.get('title') or 'Untitled Broadcast',
|
'title': info.get('title') or 'Untitled Broadcast',
|
||||||
'age_limit': int_or_none(info.get('ageRating')),
|
'age_limit': int_or_none(info.get('ageRating')),
|
||||||
'description': info.get('description'),
|
'description': info.get('description'),
|
||||||
'dislike_count': int_or_none(info.get('stats').get('raw').get('dislikes')),
|
|
||||||
'display_id': info.get('titleSlug'),
|
'display_id': info.get('titleSlug'),
|
||||||
'duration': int_or_none(info.get('duration')),
|
'duration': int_or_none(info.get('duration')),
|
||||||
'like_count': int_or_none(info.get('stats').get('raw').get('likes')),
|
|
||||||
'thumbnail': info.get('_links').get('thumbnail').get('href'),
|
|
||||||
'timestamp': int_or_none(info.get('whenCreated')),
|
'timestamp': int_or_none(info.get('whenCreated')),
|
||||||
'uploader': info.get('username'),
|
'uploader': info.get('username'),
|
||||||
'uploader_id': info.get('userSlug'),
|
'uploader_id': info.get('userSlug'),
|
||||||
'view_count': int_or_none(info.get('stats').get('raw').get('views')),
|
|
||||||
'is_live': True if info.get('active') else False,
|
'is_live': True if info.get('active') else False,
|
||||||
}
|
}
|
||||||
|
if info.get('stats') and info['stats'].get('raw'):
|
||||||
|
stats = info['stats']['raw']
|
||||||
|
data.update({
|
||||||
|
'like_count': int_or_none(stats.get('likes')),
|
||||||
|
'dislike_count': int_or_none(stats.get('dislikes')),
|
||||||
|
'view_count': int_or_none(stats.get('views')),
|
||||||
|
})
|
||||||
|
if info.get('_links') and info['_links'].get('thumbnail'):
|
||||||
|
if info['_links']['thumbnail'].get('href'):
|
||||||
|
data['thumbnail'] = info['_links']['thumbnail']['href']
|
||||||
|
return data
|
||||||
|
|
||||||
def _extract_formats(self, fmts):
|
def _extract_formats(self, fmts):
|
||||||
formats = []
|
formats = []
|
||||||
@ -86,12 +94,12 @@ class StreamMeIE(InfoExtractor):
|
|||||||
# I don't know all the possible protocols yet.
|
# I don't know all the possible protocols yet.
|
||||||
# 'protocol': 'm3u8_native' if fmt_tag == 'mp4-hls' else 'http'
|
# 'protocol': 'm3u8_native' if fmt_tag == 'mp4-hls' else 'http'
|
||||||
})
|
})
|
||||||
if d.get('origin') is not None and d.get('origin').get('location') is not None:
|
if d.get('origin') and d['origin'].get('location'):
|
||||||
fmt_tag = d['origin']['location'].split(':')[0]
|
fmt_tag = d['origin']['location'].split(':')[0]
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': d.get('origin').get('location'),
|
'url': d['origin']['location'],
|
||||||
'acodec': d.get('origin').get('audioCodec'),
|
'acodec': d['origin'].get('audioCodec'),
|
||||||
'vcodec': d.get('origin').get('videoCodec'),
|
'vcodec': d['origin'].get('videoCodec'),
|
||||||
'format_id': 'Source-' + fmt_tag,
|
'format_id': 'Source-' + fmt_tag,
|
||||||
'ext': 'flv' if fmt_tag == 'rtmp' else 'mp4',
|
'ext': 'flv' if fmt_tag == 'rtmp' else 'mp4',
|
||||||
'source_preference': 1,
|
'source_preference': 1,
|
||||||
@ -113,6 +121,7 @@ class StreamMeLiveIE(StreamMeIE):
|
|||||||
'uploader': 'KombatCup',
|
'uploader': 'KombatCup',
|
||||||
'like_count': int,
|
'like_count': int,
|
||||||
'dislike_count': int,
|
'dislike_count': int,
|
||||||
|
'thumbnail': 're:https?://.*.jpg$',
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
},
|
},
|
||||||
'skip': 'kombatcup is offline',
|
'skip': 'kombatcup is offline',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user