From ca25624b1ae04081b0479d16c73d34da5d316733 Mon Sep 17 00:00:00 2001 From: sh!zeeg Date: Wed, 4 Jan 2017 04:43:39 +0300 Subject: [PATCH] [StreamMe] make sure "id" and "title" always present --- youtube_dl/extractor/streamme.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/streamme.py b/youtube_dl/extractor/streamme.py index 72acb690a..60b837ba4 100644 --- a/youtube_dl/extractor/streamme.py +++ b/youtube_dl/extractor/streamme.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( int_or_none, + compat_str, ExtractorError, ) @@ -50,9 +51,9 @@ class StreamMeIE(InfoExtractor): def _extract_info(self, info): data = { - 'id': info.get('urlId') or info['publicId'], + 'id': info.get('urlId') or info.get('publicId'), # 'formats': self.formats, - 'title': info.get('title') or 'Untitled Broadcast', + 'title': info.get('title'), 'age_limit': int_or_none(info.get('ageRating')), 'description': info.get('description'), 'display_id': info.get('titleSlug'), @@ -152,6 +153,11 @@ class StreamMeLiveIE(StreamMeIE): self._sort_formats(formats, 'vbr') info = self._extract_info(stream_info) info['formats'] = formats + if not info.get('title'): + info['title'] = self._live_title(data.get('displayName') or channel_id) + if not info.get('id'): + info['id'] = compat_str(abs(hash('%s/%s' % (channel_id, formats[0]))) % (10 ** 6)) + return info