hannad4 / instaFollow

A follower/following tracker for medium sized (~0-300 followers/following) Instagram accounts
0 stars 0 forks source link

help #2

Closed Boryyy closed 3 years ago

Boryyy commented 3 years ago

image

logged in , goes to profile , does nothing like 5 seconds and then shows this

hannad4 commented 3 years ago

this is a bug I noticed soon after releasing this. Going to release a fix hopefully soon, within the next week or so at most, but probably within about two days if not less

Boryyy commented 3 years ago

oh okay , thanks for your time , can you help me with somthing else? like when i loggin in a bot account , and then check the account i tell to check not the account itself? like a instagram.com/{target} ?

hannad4 commented 3 years ago

Not sure I understand what your question is. If you are talking about this program, filtering features is not implemented. But after you write the results to a text file, you can just search for whatever account you want to not be counted and remove it from the list.

Also, are you manually compiling this program to run on macOS, or are you using Windows? Can you let me know your system specs, etc.

I have attached a zip file containing a raw-code hot fix for the problem you mentioned. If you know how to, could you please try compiling this and letting me know if it fixed your problem? If you don't know how to compile, let me know and I will zip up an exe file for you.

instaFollow.zip

Boryyy commented 3 years ago

the program u sent works fine , thanks for the time ! and about the question , when the bot log in the account and goes to the profile , and scan the followers , i want to edit it so i can track other profile , like userName = input('') passWord = getpass.getpass('') and then target = input('') and then edit the html button u click after u login to go into the profile u set as target like
browser.get("https://www.instagram.com/{target}")

hannad4 commented 3 years ago

If you want to log into YOUR account, but then track the followers and following of a DIFFERENT account, then you can replace the following located in the navigateProfile(browser, user) function:

    newLink = "https://www.instagram.com/" + userName
    browser.get(newLink)

    navigateToFollowers(browser) 

Just replace userName with your target account.

You can also have the user input the target account to track in the main function, and then pass it along to attemptLogin() and subsequently navigateProfile() functions. That will keep you from having to manually edit and recompile the python file each time.

Please keep in mind that for this to work, the target profile will need to be a public one that has the followers and following lists available, or if it is a private account, the program user must have been accepted as a follower to the target account to see the lists. This program just scrapes whatever information can be seen manually on the page, so if the lists don't exist on the page, there is no way for the scraper to get it.

Let me know if you have any other questions, otherwise I will be closing this issue soon as I have pushed the hot fix code & exe release to the repo

Boryyy commented 3 years ago

@hannad4 thanks for ur time , and yea i understand what you are saying <3

Boryyy commented 3 years ago

image ehmmm , it goes back to this error i started this issue , maybe it needs xpath to be updated or somthing

hannad4 commented 3 years ago

can you send a screenshot of what you see on the browsers screen when the error happens?

I suspect there is some timeout issues occurring where the page is taking too long to load before the scraper starts looking for the element it wants

On Thu, Apr 15, 2021, 5:54 PM Boryyy @.***> wrote:

[image: image] https://user-images.githubusercontent.com/60760570/114943127-ccc00380-9e45-11eb-81a2-97bcddcc81ad.png ehmmm , it goes back to this error i started this issue , maybe it needs xpath to be updated or somthing

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hannad4/instaFollow/issues/2#issuecomment-820754128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKGMOAAB5EYE5TJHGXQ53YLTI5OCDANCNFSM426FGWRQ .

Boryyy commented 3 years ago

image Gathering your followers list Something went wrong. The program has been halted

hannad4 commented 3 years ago

The program is functioning as intended - this is not a bug.

There are several issues that you failed to address when modifying the code to monitor a target account.

Problem 1

You need to ensure that the HREF items referenced in the code are addressed to the target account, and not the user account. For example, in the following snippet:

. . .
def navigateToFollowers(browser): 
    print('\33[32m' + "\nGathering your followers list" + '\033[0m', end = "")
    followerHREF = "/" + userName + "/followers/" 
. . . 

You need to replace userName with the target account from before. You will also need to do this for the navigateToFollowing() function.

Problem 2

The profile that you are trying to test this out with (account 322v9lf) only has one follower. Note that in the snippet below:

def navigateToFollowers(browser): 
    print('\33[32m' + "\nGathering your followers list" + '\033[0m', end = "")
    followerHREF = "/" + userName + "/followers/" 
    totalFollowerCount = WebDriverWait(browser, WAIT_TIME_GLOBAL).until(EC.presence_of_element_located((By.XPATH, '//li/a[text()=" followers"]/span'))).text

The web driver waits until the element containing the text "followers" is found. The word follower is NOT the same as followers so an error will be raised.

You can technically fix this problem by changing the code to search for element containing the text "follower" instead, but this will once again break the program if this account were to gain more followers.

This program is not intended for accounts with low follower/following count, because at that point you can very easily manually check each list with minimal effort. However, it seems that you are testing this for a project or future use, which is understandable.

I have made these changes on my source code on my end to test and ensure it works properly, and it indeed does, so this should fix your issue. I will be closing this issue since the initial problem is resolved, and a fix has been provided for your situation as well. Thank you.