yogeshwaran01 / instagramy

Python Package for Instagram Users, Posts, and Hashtag data.
https://pypi.org/project/instagramy
MIT License
147 stars 34 forks source link

key errors #17

Closed Qrh45timo closed 3 years ago

Qrh45timo commented 3 years ago

Generates key errors, relevant json is moved. my tests:

import instagramy

hashtag = “…..” post_id =. “…..” user = “….”

ig_session_id = “….”

t = instagramy.InstagramHashTag(hashtag) Error Info: <class 'KeyError'>: 'TagPage'

worked correctly for some days without login, now generates this error

t = instagramy.InstagramHashTag(hashtag, sessionid=ig_session_id) Error Info: <class 'KeyError'>: 'graphql'

p = instagramy.InstagramPost(post_id, sessionid=ig_session_id) Error Info: <class 'KeyError'>: 'graphql'

I think relevant post data moved to script block: window.__additionalDataLoaded

u = instagramy.InstagramUser(user, sessionid=ig_session_id)

this works correctly

yogeshwaran01 commented 3 years ago

@Qrh45timo Make sure your Instagram account is logged in with that sessionid. If you get this error go to browser login to Instagram and copy the new session id.

Thank You,

Qrh45timo commented 3 years ago

logged into another browser for new session id. double checked session id, but didn't help - same errors.

yogeshwaran01 commented 3 years ago

@Qrh45timo It is perfect working for me. Screenshot from 2021-04-22 09-42-14

check once the session id

session id sample

If you again not error please send your location (country name) and attach the output instagramy.html file of the following script

add your session id in session_id

from instagramy.core.requests import get

session_id = "add you session id"

html_source = get("https://www.instagram.com/github/", sessionid=session_id)

print(html_source)

file = open("instagram.html", 'w')
file.write(html_source)
file.close()
Qrh45timo commented 3 years ago

done, still got error country code = NL

1] html_source = get("https://www.instagram.com/github/", sessionid=session_id) request_github.txt but this request is for user, that seems to work.

2] result for test request post CN8UG5fj6KB: html_source = get("https://www.instagram.com/p/CN8UG5fj6KB/", sessionid=session_id)

request_gisthub_post_CN8UG5fj6KB.txt

yogeshwaran01 commented 3 years ago

@Qrh45timo, Thank you for your outputs

Instagram redirects you to login page in your country you may try, Google Colab or any online interpreter. I think it work perfectly.

I try to fix this issue as soon as possible Thank You

Qrh45timo commented 3 years ago

thanks - let me know if you need some country-specific testing after fix :-)

yogeshwaran01 commented 3 years ago

@Qrh45timo Sure Thank you