InstaLooter icon indicating copy to clipboard operation
InstaLooter copied to clipboard

I am getting "graphql Error" while fetching metaData of videos posts using instalooter 2.4.4.

Open Waqas1o1 opened this issue 2 years ago • 10 comments

I can't say for sure why this error is coming but it seems like it accounts problem. I am trying to run the following script from python 3.10.0

obj = HashtagLooter(tag, dump_only=True)
obj.download_videos(f'downloads/{tag}', media_count=10, new_only=self.appendNewOnly) 

Then the Error Rised

Traceback (most recent call last): File "C:\Users\Muhamad Waqas\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run() File "F:\TECHNOVETIVE\Automation Media\Backend\instagrame\utils.py", line 66, in run obj.download_videos( File "F:\TECHNOVETIVE\Automation Media\Backend\env\lib\site-packages\instalooter\looters.py", line 395, in download_videos return self.download( File "F:\TECHNOVETIVE\Automation Media\Backend\env\lib\site-packages\instalooter\looters.py", line 469, in download
medias_queued = self._fill_media_queue( File "F:\TECHNOVETIVE\Automation Media\Backend\env\lib\site-packages\instalooter\looters.py", line 620, in _fill_media_queue media = self.get_post_info(media['shortcode']) File "F:\TECHNOVETIVE\Automation Media\Backend\env\lib\site-packages\instalooter\looters.py", line 350, in get_post_info if 'graphql' in data['entry_data']['PostPage'][0]:
KeyError: 'PostPage'

Waqas1o1 avatar Jan 21 '22 10:01 Waqas1o1

Same here, and also for pictures.

richieadler avatar Jan 23 '22 23:01 richieadler

Getting graphql errors here too.

2022-01-26 08:27:51 $user instalooter.cli[6048] NOTICE Starting download of `xxxx`
2022-01-26 08:27:55 $user instalooter.cli[6048] CRITICAL 'graphql'

ghost avatar Jan 26 '22 11:01 ghost

I'm also getting those with the comment scraping function, have been for a little over a week

    info = looter.get_post_info(media['shortcode'])
  File "/Library/Python/3.8/site-packages/instalooter/looters.py", line 355, in get_post_info
    return data['graphql']['shortcode_media']
KeyError: 'graphql'

ghostbeagle avatar Jan 27 '22 18:01 ghostbeagle

It seems like instagram now loads "PostPage" contents dynamically so a simple request to https://www.instagram.com/p/XXXXXX/ will not contain the required data

FilipJanitor avatar Feb 05 '22 12:02 FilipJanitor

It seems like instagram now loads "PostPage" contents dynamically so a simple request to https://www.instagram.com/p/XXXXXX/ will not contain the required data

yeah do you think that there is any way to work around that

Lxand3r avatar Feb 07 '22 21:02 Lxand3r

I'm also getting those with the comment scraping function, have been for a little over a week

    info = looter.get_post_info(media['shortcode'])
  File "/Library/Python/3.8/site-packages/instalooter/looters.py", line 355, in get_post_info
    return data['graphql']['shortcode_media']
KeyError: 'graphql'

This is correct. If you comment out the offending line (looters.py line 355) and print data, you can see that the data structure returned from instagram has changed (no more 'graphql' or 'shortcode_media'). This sloppy hack (below) prints the new data structure and got it kinda unstuck by mapping the new 'media_type' to the old '__typename', but it failed elsewhere later on.

#return data['graphql']['shortcode_media']
print(data)
result = dict();
result['shortcode'] = data['items'][0]['code']
result['id'] = data['items'][0]['pk']
result['__typename'] = "GraphSidecar"
if data['items'][0]['media_type'] == 1:
    result['__typename'] = "GraphImage"
if data['items'][0]['media_type'] == 2:
    result['__typename'] = "GraphVideo"
return result

It seems this application needs to be significantly re-written to be adapted to the new Instagram API, and it was not written in a modular way that abstracted the API to make it easily swappable.

zambetti avatar Feb 17 '22 15:02 zambetti

It seems to be working again... But only temporarily - after a while the lazyloading kicked in again

FilipJanitor avatar Feb 26 '22 17:02 FilipJanitor

Hey Anyone what the go through of the issue I am facing the issues

Ajit021 avatar Mar 09 '22 06:03 Ajit021

same issue. Implementing the work around from @zambettl results in:

KeyError: 'edge_sidecar_to_children'

cyphunk avatar Apr 22 '22 16:04 cyphunk

debian 9 python 3.5 same issue

gree303 avatar May 01 '22 21:05 gree303