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

Fixes .com// in public api url and updates query_hash's for user_following_gql_chunk and user_followers_gql_chunk #1666

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

jarrodnorwell
Copy link
Contributor

public.py#L208-L210 has been modified to replace any unwanted .com//.* strings with .com/.*

user.py#L509 has been modified to use an up-to-date query_hash for user_following_gql_chunk

user.py#L664 has been modified to use an up-to-date query_hash for user_followers_gql_chunk

Fixes #1648, #1638, #1580, #1060, #864
Possible fix for #1050

@subzeroid subzeroid merged commit c9e6ba5 into subzeroid:master Nov 30, 2023
4 of 9 checks passed
@subzeroid
Copy link
Owner

@jarrodnorwell big thanks!

@s-alad
Copy link

s-alad commented Dec 11, 2023

user_following_gql still does not return the list of usershorts unfortunately

def fastestcompare(self, tolookup):
        user_id = self.session.user_id_from_username(tolookup)
        following = self.session.user_following_gql(user_id=user_id)

@jarrodnorwell
Copy link
Contributor Author

Are you using the GitHub or PyPI version of the project @s-alad? I did testing myself with the fix and it was working

@s-alad
Copy link

s-alad commented Dec 11, 2023

I'm using PyPi, I just ran pip3 install instagrapi

Would this fix not be included in the version I pulled?

@jarrodnorwell
Copy link
Contributor Author

@s-alad right now the fix is only on GitHub afaik, you'll need to install it through Git pip install git+https://... to install the version with the fixes (until available on PyPI, if ever)

@s-alad
Copy link

s-alad commented Dec 12, 2023

Thank you will try the github version and update

@s-alad
Copy link

s-alad commented Dec 26, 2023

@jarrodnorwell I just tried

$ pip install git+https://github.com/jarrodnorwell/instagrapi.git@master
> Successfully installed instagrapi-2.0.0 pydantic-2.5.2 pydantic-core-2.14.5

and the same with $ pip install git+https://github.com/subzeroid/instagrapi
however user_following_gql still does not work. Am I doing something wrong?

@jarrodnorwell
Copy link
Contributor Author

@s-alad Could you send the error that comes up? I'll take another look today and see what's happening

@s-alad
Copy link

s-alad commented Dec 26, 2023

@jarrodnorwell There's no error the function just doesn't return anything when the account I'm testing on has a following list. Returns an empty list

def __init__(self, username: str = '', password: str = ''):
        self.username = username
        self.password = password
        self.session = Client()
        self.session.request_timeout = .25

def fastestcompare(self, tolookup: str):
        user_id = self.session.user_id_from_username(tolookup)
        following = self.session.user_following_gql(user_id=user_id)
        followers = self.session.user_followers_gql(user_id=user_id)
        flwng = []
        flwrs = []
        for follow in following:
            flwng.append(follow.username)
        for follower in followers:
            flwrs.append(follower.username)

        print('------------------------------------')
        print("Followers: ", flwrs)
        print('------------------------------------')
        print("Following: ", flwng)
        print('------------------------------------')     

def login(self): ...
load_dotenv()
bot = Bot(username=os.getenv('account_name'), password=os.getenv('account_pass'))
bot.currentworkingdirectory()
bot.login()
bot.fastcompare('<username>')
$ Followers:  [ <... list of followers ...> ]
$ Following: [] 

returns an empty list when it should be populatede

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

Successfully merging this pull request may close these issues.

[BUG] user_following_gql not working (returning no data)
3 participants