|
|
|
@ -4,6 +4,7 @@ from ..utils import (
|
|
|
|
|
parse_iso8601,
|
|
|
|
|
unescapeHTML,
|
|
|
|
|
)
|
|
|
|
|
from ..utils.traversal import traverse_obj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PeriscopeBaseIE(InfoExtractor):
|
|
|
|
@ -20,8 +21,6 @@ class PeriscopeBaseIE(InfoExtractor):
|
|
|
|
|
title = broadcast.get('status') or 'Periscope Broadcast'
|
|
|
|
|
uploader = broadcast.get('user_display_name') or broadcast.get('username')
|
|
|
|
|
title = '%s - %s' % (uploader, title) if uploader else title
|
|
|
|
|
is_live = broadcast.get('state').lower() == 'running'
|
|
|
|
|
|
|
|
|
|
thumbnails = [{
|
|
|
|
|
'url': broadcast[image],
|
|
|
|
|
} for image in ('image_url', 'image_url_medium', 'image_url_small') if broadcast.get(image)]
|
|
|
|
@ -31,12 +30,16 @@ class PeriscopeBaseIE(InfoExtractor):
|
|
|
|
|
'title': title,
|
|
|
|
|
'timestamp': parse_iso8601(broadcast.get('created_at')) or int_or_none(
|
|
|
|
|
broadcast.get('created_at_ms'), scale=1000),
|
|
|
|
|
'release_timestamp': int_or_none(broadcast.get('scheduled_start_ms'), scale=1000),
|
|
|
|
|
'uploader': uploader,
|
|
|
|
|
'uploader_id': broadcast.get('user_id') or broadcast.get('username'),
|
|
|
|
|
'thumbnails': thumbnails,
|
|
|
|
|
'view_count': int_or_none(broadcast.get('total_watched')),
|
|
|
|
|
'tags': broadcast.get('tags'),
|
|
|
|
|
'is_live': is_live,
|
|
|
|
|
'live_status': {
|
|
|
|
|
'running': 'is_live',
|
|
|
|
|
'not_started': 'is_upcoming',
|
|
|
|
|
}.get(traverse_obj(broadcast, ('state', {str.lower}))) or 'was_live'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|