From 1e10ab8669763d66e6088fa8cbed374db292d6d8 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 14 Jul 2017 15:29:09 +0200 Subject: [PATCH] Revert "Replaced usages of shortcode with mediaid" This reverts commit 715582138b32a0a44d24c8d0e600d0b9de99eb25. It broke downloading sidecars and did not introduce any advantageous behavior. --- instaloader.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/instaloader.py b/instaloader.py index 19d0ef7..c86987b 100755 --- a/instaloader.py +++ b/instaloader.py @@ -528,8 +528,7 @@ class Instaloader: date = node["date"] if "date" in node else node["taken_at_timestamp"] if '__typename' in node: if node['__typename'] == 'GraphSidecar': - sidecar_data = self.session.get('https://www.instagram.com/p/' + - mediaid_to_shortcode(int(node['id'])) + '/', + sidecar_data = self.session.get('https://www.instagram.com/p/' + node['code'] + '/', params={'__a': 1}).json() edge_number = 1 downloaded = True @@ -563,8 +562,7 @@ class Instaloader: self.save_caption(name, date, node["caption"]) else: self._log("", end=' ', flush=True) - node_id = node['id'] if 'id' in node else node['media_id'] - node_code = mediaid_to_shortcode(int(node_id)) + node_code = node['shortcode'] if 'shortcode' in node else node['code'] if node["is_video"] and download_videos: video_data = self.get_json('p/' + node_code) self.download_pic(name, @@ -657,8 +655,7 @@ class Instaloader: if max_count is not None and count > max_count: return if lookup_username: - node_id = node['id'] if 'id' in node else node['media_id'] - metadata = self.get_node_metadata(mediaid_to_shortcode(int(node_id))) + metadata = self.get_node_metadata(node['shortcode'] if 'shortcode' in node else node['code']) pathname = metadata['owner']['username'] else: pathname = '#{0}'.format(hashtag)