aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/twitch.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-08-17 20:20:04 +0600
committerSergey M․ <dstftw@gmail.com>2015-08-17 20:20:04 +0600
commit7a6e8a1b17a6a821d9200531ebf65562ccc2d428 (patch)
tree10aa013f2db79d5630633d4e2d981c282c3ab82d /youtube_dl/extractor/twitch.py
parent369c12e038c3183a0e725a929dd9bed4ec35fa11 (diff)
downloadyoutube-dl-7a6e8a1b17a6a821d9200531ebf65562ccc2d428.zip
youtube-dl-7a6e8a1b17a6a821d9200531ebf65562ccc2d428.tar.gz
youtube-dl-7a6e8a1b17a6a821d9200531ebf65562ccc2d428.tar.bz2
[twitch] Make more robust
Diffstat (limited to 'youtube_dl/extractor/twitch.py')
-rw-r--r--youtube_dl/extractor/twitch.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py
index 0521257..8cba97b 100644
--- a/youtube_dl/extractor/twitch.py
+++ b/youtube_dl/extractor/twitch.py
@@ -15,6 +15,7 @@ from ..compat import (
)
from ..utils import (
ExtractorError,
+ int_or_none,
parse_duration,
parse_iso8601,
)
@@ -133,13 +134,13 @@ class TwitchItemBaseIE(TwitchBaseIE):
return {
'id': info['_id'],
'title': info.get('title') or 'Untitled Broadcast',
- 'description': info['description'],
- 'duration': info['length'],
- 'thumbnail': info['preview'],
- 'uploader': info['channel']['display_name'],
- 'uploader_id': info['channel']['name'],
- 'timestamp': parse_iso8601(info['recorded_at']),
- 'view_count': info['views'],
+ 'description': info.get('description'),
+ 'duration': int_or_none(info.get('length')),
+ 'thumbnail': info.get('preview'),
+ 'uploader': info.get('channel', {}).get('display_name'),
+ 'uploader_id': info.get('channel', {}).get('name'),
+ 'timestamp': parse_iso8601(info.get('recorded_at')),
+ 'view_count': int_or_none(info.get('views')),
}
def _real_extract(self, url):