Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Waqas1o1 opened this issue Jan 21, 2022 · 10 comments

Comments

@Waqas1o1
Copy link

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'

@richieadler
Copy link

Same here, and also for pictures.

@ghost
Copy link

ghost commented Jan 26, 2022

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'

@FilipJanitor
Copy link

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

@Lxand3r
Copy link

Lxand3r commented Feb 7, 2022

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

@zambetti
Copy link

zambetti commented Feb 17, 2022

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.

@FilipJanitor
Copy link

FilipJanitor commented Feb 26, 2022

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

@Ajit021
Copy link

Ajit021 commented Mar 9, 2022

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

@cyphunk
Copy link

cyphunk commented Apr 22, 2022

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

KeyError: 'edge_sidecar_to_children'

@gree303
Copy link

gree303 commented May 1, 2022

debian 9 python 3.5 same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants