From: Yen Chi Hsuan Date: Sun, 7 Jun 2015 17:17:21 +0000 (+0800) Subject: [instagram] Handling null values (fixes #5919) X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=edb99d4c18475ba27fae4f7d0ec6e3db9b574885;p=youtube-dl [instagram] Handling null values (fixes #5919) I didn't add the test case here because it takes too much time. (7 minutes on my machine) --- diff --git a/youtube_dl/extractor/instagram.py b/youtube_dl/extractor/instagram.py index b10755788..b92367a9d 100644 --- a/youtube_dl/extractor/instagram.py +++ b/youtube_dl/extractor/instagram.py @@ -100,7 +100,9 @@ class InstagramUserIE(InfoExtractor): thumbnails_el = it.get('images', {}) thumbnail = thumbnails_el.get('thumbnail', {}).get('url') - title = it.get('caption', {}).get('text', it['id']) + # In some cases caption is null, which corresponds to None + # in python. As a result, it.get('caption', {}) gives None + title = (it.get('caption') or {}).get('text', it['id']) entries.append({ 'id': it['id'],