Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

'Username does not exist' on some accounts #11

Closed
rEnr3n opened this issue Mar 2, 2020 · 2 comments
Closed

'Username does not exist' on some accounts #11

rEnr3n opened this issue Mar 2, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@rEnr3n
Copy link

rEnr3n commented Mar 2, 2020

$ python --version
Python 3.8.1
$ python InstaTracker.py -u g.mi
[-] Username does not exist
$ python InstaTracker.py -u 'g.mi'
[-] Username does not exist
$ python InstaTracker.py -u so_____y_
[-] Username does not exist
$ python InstaTracker.py -u 'so_____y_'
[-] Username does not exist
$ python InstaTracker.py -u _glam.diva_
[-] Username does not exist
$ python InstaTracker.py -u '_glam.diva_'
[-] Username does not exist
@darylkell
Copy link

darylkell commented Mar 2, 2020

usernameToUserId() receives JSON from Instagram where the first result doesn't match the username being sought, and because the function only checks the first index for the right user, you're getting the 'does not exist' result being returned.
Instagram could be returning the results in this order because the profiles that are being returned in higher order have paid to make themselves the highest priority result...?

A fix for Instatrack might be that the results being returned are iterated through until the right username is found, such as in the sample code below.

`import requests
names = ["g.mi", "so_____y_", "glam.diva"]

for name in names:
data = requests.get(f"https://www.instagram.com/web/search/topsearch/?query={name}").json()

for user_data in data["users"]:
	if user_data["user"]["username"] == name:
		print(f"Name: {name}\nID: {user_data['user']['pk']}\n")`

Output:
Name: g.mi
ID: 1283104053

Name: so_____y_
ID: 1065286586

Name: glam.diva
ID: 2113578179

@Snbig Snbig added the bug Something isn't working label Mar 2, 2020
@Snbig
Copy link
Owner

Snbig commented Mar 2, 2020

Fixed by new commit: 7946c6c
@darylkell, Thank you for your editing suggestion.

@Snbig Snbig closed this as completed Mar 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants