aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/gfycat.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-07-07 14:22:13 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-07-07 14:22:13 +0800
commit267dc07e6b71277b67abad08c515ca9c1bb09f61 (patch)
treede9a3c7498d9f94145fdbf93d183e7f0d006ca97 /youtube_dl/extractor/gfycat.py
parentd7b4d5dd5072fc82a7f3d437e5990aa74a35a100 (diff)
[gfycat] Catch errors
Diffstat (limited to 'youtube_dl/extractor/gfycat.py')
-rw-r--r--youtube_dl/extractor/gfycat.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/extractor/gfycat.py b/youtube_dl/extractor/gfycat.py
index 048ee31e2..884700c52 100644
--- a/youtube_dl/extractor/gfycat.py
+++ b/youtube_dl/extractor/gfycat.py
@@ -6,6 +6,7 @@ from ..utils import (
int_or_none,
float_or_none,
qualities,
+ ExtractorError,
)
@@ -50,7 +51,10 @@ class GfycatIE(InfoExtractor):
gfy = self._download_json(
'http://gfycat.com/cajax/get/%s' % video_id,
- video_id, 'Downloading video info')['gfyItem']
+ video_id, 'Downloading video info')
+ if 'error' in gfy:
+ raise ExtractorError('Gfycat said: ' + gfy['error'], expected=True)
+ gfy = gfy['gfyItem']
title = gfy.get('title') or gfy['gfyName']
description = gfy.get('description')