yogeshwaran01 / instagramy

Python Package for Instagram Users, Posts, and Hashtag data.

Home Page:https://pypi.org/project/instagramy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error scrapping hashtags - Graphql KeyError

nansravn opened this issue · comments

When I execute this code:

from instagramy import InstagramHashTag
tag_latest = InstagramHashTag("my_hashtag", sessionid="my_session_id")

I receive the following error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-1-bb45efb6917a> in <module>
      1 from instagramy import InstagramHashTag
----> 2 tag_latest = InstagramHashTag("******", sessionid="4609********************")

C:\ProgramData\Miniconda3\envs\scrap38\lib\site-packages\instagramy\InstagramHashTag.py in __init__(self, tag, sessionid, from_cache)
     58             data = self.get_json()
     59             cache.make_cache(
---> 60                 tag, data["entry_data"]["TagPage"][0]["graphql"]["hashtag"]
     61             )
     62             try:

KeyError: 'graphql'

Apparently this graphql key doesn't exist inside the object data["entry_data"]["TagPage"][0].

It is perfectly working for me, your session id may be incorrect.
Screenshot from 2021-04-16 16-28-49