mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
[instagram] data not none even when missing cookies
This commit is contained in:
parent
92ac149d54
commit
980ba1bc2e
@ -22,14 +22,15 @@ def instagram_download(url, output_dir='.', merge=True, info_only=False, **kwarg
|
|||||||
download_urls([stream], title, ext, size, output_dir, merge=merge)
|
download_urls([stream], title, ext, size, output_dir, merge=merge)
|
||||||
else:
|
else:
|
||||||
data = re.search(r'window\._sharedData\s*=\s*(.*);</script>', html)
|
data = re.search(r'window\._sharedData\s*=\s*(.*);</script>', html)
|
||||||
if data is not None:
|
try:
|
||||||
info = json.loads(data.group(1))
|
info = json.loads(data.group(1))
|
||||||
post = info['entry_data']['PostPage'][0]
|
post = info['entry_data']['PostPage'][0]
|
||||||
else:
|
assert post
|
||||||
|
except:
|
||||||
# with logged-in cookies
|
# with logged-in cookies
|
||||||
data = re.search(r'window\.__additionalDataLoaded\(\'[^\']+\',(.*)\);</script>', html)
|
data = re.search(r'window\.__additionalDataLoaded\(\'[^\']+\',(.*)\);</script>', html)
|
||||||
if data is not None:
|
if data is not None:
|
||||||
log.e('[Error] Cookies needed.')
|
log.e('[Warning] Cookies needed.')
|
||||||
post = json.loads(data.group(1))
|
post = json.loads(data.group(1))
|
||||||
|
|
||||||
if 'edge_sidecar_to_children' in post['graphql']['shortcode_media']:
|
if 'edge_sidecar_to_children' in post['graphql']['shortcode_media']:
|
||||||
|
Loading…
Reference in New Issue
Block a user