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

Fix for broken _dis, using web_profile #2003

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions instagrapi/mixins/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ def public_a1_request(self, endpoint, data=None, params=None, headers=None):
)
return response.get("graphql") or response

def public_a1_request_user_info_by_username(self, username, data=None, params=None):
params = params or {}
url = self.PUBLIC_API_URL + f"api/v1/users/web_profile_info/?username={username}"
headers = {'x-ig-app-id': '936619743392459'}
response = self.public_request(
url, data=data, params=params, headers=headers, return_json=True
)
return response.get("user") or response

def public_graphql_request(
self,
variables,
Expand Down
2 changes: 1 addition & 1 deletion instagrapi/mixins/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def user_info_by_username_gql(self, username: str) -> User:
An object of User type
"""
username = str(username).lower()
return extract_user_gql(self.public_a1_request(f"/{username!s}/")["user"])
return extract_user_gql(self.public_a1_request_user_info_by_username(f"/{username!s}/")["user"])

def user_info_by_username_v1(self, username: str) -> User:
"""
Expand Down
2 changes: 1 addition & 1 deletion instagrapi/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Broadcast(TypesBaseModel):
group_image_background_uri: str
thread_subtype: int
number_of_members: int
creator_igid: str | None
creator_igid: Optional[str]
creator_username: str


Expand Down