1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-09-11 16:22:24 +02:00

Revert "Replaced usages of shortcode with mediaid"

This reverts commit 715582138b.

It broke downloading sidecars and did not introduce any advantageous
behavior.
This commit is contained in:
Alexander Graf 2017-07-14 15:29:09 +02:00
parent c0eecd1bd2
commit 1e10ab8669

View File

@ -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("<no caption>", 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)