mirror of
https://github.com/instaloader/instaloader.git
synced 2024-11-04 09:22:29 +01:00
Parse graphql structure for sidecars
This commit is contained in:
parent
8e77a1c125
commit
0e943189e5
@ -469,12 +469,13 @@ def download_node(node: Dict[str, Any], session: requests.Session, name: str,
|
|||||||
if node['__typename'] == 'GraphSidecar':
|
if node['__typename'] == 'GraphSidecar':
|
||||||
sidecar_data = session.get('https://www.instagram.com/p/' + node['code'] + '/', params={'__a': 1}).json()
|
sidecar_data = session.get('https://www.instagram.com/p/' + node['code'] + '/', params={'__a': 1}).json()
|
||||||
edge_number = 1
|
edge_number = 1
|
||||||
downloaded = False
|
downloaded = True
|
||||||
for edge in sidecar_data['media']['edge_sidecar_to_children']['edges']:
|
media = sidecar_data["graphql"]["shortcode_media"] if "graphql" in sidecar_data else sidecar_data["media"]
|
||||||
|
for edge in media['edge_sidecar_to_children']['edges']:
|
||||||
edge_downloaded = download_pic(name, edge['node']['display_url'],date,
|
edge_downloaded = download_pic(name, edge['node']['display_url'],date,
|
||||||
filename_suffix=str(edge_number), quiet=quiet,
|
filename_suffix=str(edge_number), quiet=quiet,
|
||||||
outputlabel=(str(edge_number) if edge_number != 1 else None))
|
outputlabel=(str(edge_number) if edge_number != 1 else None))
|
||||||
downloaded = downloaded or edge_downloaded
|
downloaded = downloaded and edge_downloaded
|
||||||
edge_number += 1
|
edge_number += 1
|
||||||
if sleep:
|
if sleep:
|
||||||
time.sleep(1.75 * random.random() + 0.25)
|
time.sleep(1.75 * random.random() + 0.25)
|
||||||
|
Loading…
Reference in New Issue
Block a user