From adeb58847146145af016dee464c183e20216073c Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Sun, 13 Aug 2017 12:51:39 +0200 Subject: [PATCH] Fix KeyError when generating NodeUnavailable error Fixes #32. --- instaloader.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/instaloader.py b/instaloader.py index 24c3189..be60fe3 100755 --- a/instaloader.py +++ b/instaloader.py @@ -868,7 +868,7 @@ class Instaloader: download_comments=download_comments) except NodeUnavailableException: print("Unable to download node \"https://www.instagram.com/p/{}/\" of user {} from feed." - .format(node['shortcode'], name), file=sys.stderr) + .format(node['shortcode'] if 'shortcode' in node else node['code'], name), file=sys.stderr) continue if fast_update and not downloaded: return @@ -917,7 +917,8 @@ class Instaloader: download_comments=download_comments) except NodeUnavailableException: print("Unable to download node \"https://www.instagram.com/p/{}/\" " - "while downloading hashtag \"{}\".".format(node['shortcode'], hashtag), file=sys.stderr) + "while downloading hashtag \"{}\"." + .format(node['shortcode'] if 'shortcode' in node else node['code'], hashtag), file=sys.stderr) continue if fast_update and not downloaded: return @@ -1034,7 +1035,7 @@ class Instaloader: download_comments=download_comments) except NodeUnavailableException: print("Unable to download node \"https://www.instagram.com/p/{}/\" of user {}." - .format(node['shortcode'], name), file=sys.stderr) + .format(node['shortcode'] if 'shortcode' in node else node['code'], name), file=sys.stderr) continue if fast_update and not downloaded: return