shine-jayakumar / insta-likecom-bot

Automates likes and comments on an instagram account or tag
MIT License
140 stars 30 forks source link

Can't login #70

Closed steevenakintilo closed 8 months ago

steevenakintilo commented 1 year ago

Hello I've tried to login to several accounts but I always got the same error I don't know why `/home/asteeven/.asdf/installs/python/3.11.0/lib/python3.11/site-packages/requests/init.py:102: RequestsDependencyWarning: urllib3 (1.26.8) or chardet (5.1.0)/charset_normalizer (2.0.11) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " [*] => Error opening file: 433

 ___ _  _ ___ _____ _      _    ___ _  _____ ___ ___  __  __     ___  ___ _____ 
|_ _| \| / __|_   _/_\ ___| |  |_ _| |/ | __/ __/ _ \|  \/  |___| _ )/ _ |_   _|
 | || .` \__ \ | |/ _ |___| |__ | || ' <| _| (_| (_) | |\/| |___| _ | (_) || |  
|___|_|\_|___/ |_/_/ \_\  |____|___|_|\_|___\___\___/|_|  |_|   |___/\___/ |_|  

insta-likecom-bot v.3.0.2
Automates likes and comments on an instagram account or tag

Author: Shine Jayakumar
Github: https://github.com/shine-jayakumar
Copyright (c) 2023 Shine Jayakumar
LICENSE: MIT

[] => Script started [] => Downloading webdriver for your version of Chrome [] => Loading Instagram [] => Delay: 1-10 secs [] => Attempting to log in with akintilo_steeven [] => Script ended with error [] => Error: [LoginFailedError] - Failed to login. Incorrect username/password, or 2 factor verification is active. Traceback (most recent call last): File "/home/asteeven/Python/instaaa/insta-likecom-bot/ilcbot.py", line 113, in raise LoginFailedError("Failed to login. Incorrect username/password, or 2 factor verification is active.") modules.exceptions.LoginFailedError: Failed to login. Incorrect username/password, or 2 factor verification is active. [] => Total time taken: 3.4561 seconds `

steevenakintilo commented 1 year ago

I'm on Fedora36

shine-jayakumar commented 1 year ago

Can you share the arguments you used for the script?

ap0l0 commented 1 year ago

yes here it is: python ilcbot.py -u no_world_record -p sangokuhomer1 -t 433 -np 2

I think the target is the problem, -t needs to have an account or tag for example:

-t "#berlin"

Also, I would edit your comment and remove the password you shared.

steevenakintilo commented 1 year ago

Already changed the password got the same error with this python ilcbot.py -u akesqfqsfsqfn -p sqfqsfsf -t "berlin" -np 10

-u - p where with right account info

shine-jayakumar commented 1 year ago

@steevenakintilo Deleted your comment because of username/password. Is 2-factor authentication enabled? If yes, you may have to type in the code. 2factor

steevenakintilo commented 1 year ago

No need to delete the comment I changed the password and it's just 6 years old account I just used for testing this so it's fine but I don't have 2 factor authentification on any of my instagram accounts

andrejfz commented 1 year ago

anche a me da lo stesso errore e non ho autenticazione a due fattori

Szymok commented 1 year ago

Me too

shine-jayakumar commented 1 year ago

Me too

Please share the logs (after hiding your username)

Szymok commented 1 year ago

Me too

Please share the logs (after hiding your username)

[2023-09-24 14:04:19,426]:[ilcbot]:[:354]:[INFO]:Total time taken: 14.8958 seconds [2023-09-24 14:04:26,142]:[profile]:[parse_targets_multi:405]:[ERROR]:Error opening file: elonmusk [2023-09-24 14:04:26,144]:[ilcbot]:[:43]:[INFO]:Script started [2023-09-24 14:04:26,145]:[ilcbot]:[:45]:[INFO]:Downloading webdriver for your version of Chrome [2023-09-24 14:04:26,146]:[ilcbot]:[:48]:[INFO]:Loading Instagram [2023-09-24 14:04:31,932]:[ilcbot]:[:60]:[INFO]:Delay: 1-10 secs [2023-09-24 14:04:31,933]:[ilcbot]:[:111]:[INFO]:Attempting to log in with username [2023-09-24 14:04:34,822]:[ilcbot]:[:347]:[ERROR]:Script ended with error [2023-09-24 14:04:34,823]:[ilcbot]:[:348]:[ERROR]:Error: [LoginFailedError] - Failed to login. Incorrect username/password, or 2 factor verification is active. Traceback (most recent call last): File "..\instalike\insta-likecom-bot\ilcbot.py", line 113, in raise LoginFailedError("Failed to login. Incorrect username/password, or 2 factor verification is active.") modules.exceptions.LoginFailedError: Failed to login. Incorrect username/password, or 2 factor verification is active. [2023-09-24 14:04:37,348]:[ilcbot]:[:354]:[INFO]:Total time taken: 11.2059 seconds

The password was correct and i do not have 2 factor ver(disabled for using the bot)

shine-jayakumar commented 1 year ago

Me too

Please share the logs (after hiding your username)

[2023-09-24 14:04:19,426]:[ilcbot]:[:354]:[INFO]:Total time taken: 14.8958 seconds [2023-09-24 14:04:26,142]:[profile]:[parse_targets_multi:405]:[ERROR]:Error opening file: elonmusk [2023-09-24 14:04:26,144]:[ilcbot]:[:43]:[INFO]:Script started [2023-09-24 14:04:26,145]:[ilcbot]:[:45]:[INFO]:Downloading webdriver for your version of Chrome [2023-09-24 14:04:26,146]:[ilcbot]:[:48]:[INFO]:Loading Instagram [2023-09-24 14:04:31,932]:[ilcbot]:[:60]:[INFO]:Delay: 1-10 secs [2023-09-24 14:04:31,933]:[ilcbot]:[:111]:[INFO]:Attempting to log in with username [2023-09-24 14:04:34,822]:[ilcbot]:[:347]:[ERROR]:Script ended with error [2023-09-24 14:04:34,823]:[ilcbot]:[:348]:[ERROR]:Error: [LoginFailedError] - Failed to login. Incorrect username/password, or 2 factor verification is active. Traceback (most recent call last): File "..\instalike\insta-likecom-bot\ilcbot.py", line 113, in raise LoginFailedError("Failed to login. Incorrect username/password, or 2 factor verification is active.") modules.exceptions.LoginFailedError: Failed to login. Incorrect username/password, or 2 factor verification is active. [2023-09-24 14:04:37,348]:[ilcbot]:[:354]:[INFO]:Total time taken: 11.2059 seconds

The password was correct and i do not have 2 factor ver(disabled for using the bot)

What's the version of the script you're using?

Szymok commented 1 year ago

Me too

Please share the logs (after hiding your username)

[2023-09-24 14:04:19,426]:[ilcbot]:[:354]:[INFO]:Total time taken: 14.8958 seconds [2023-09-24 14:04:26,142]:[profile]:[parse_targets_multi:405]:[ERROR]:Error opening file: elonmusk [2023-09-24 14:04:26,144]:[ilcbot]:[:43]:[INFO]:Script started [2023-09-24 14:04:26,145]:[ilcbot]:[:45]:[INFO]:Downloading webdriver for your version of Chrome [2023-09-24 14:04:26,146]:[ilcbot]:[:48]:[INFO]:Loading Instagram [2023-09-24 14:04:31,932]:[ilcbot]:[:60]:[INFO]:Delay: 1-10 secs [2023-09-24 14:04:31,933]:[ilcbot]:[:111]:[INFO]:Attempting to log in with username [2023-09-24 14:04:34,822]:[ilcbot]:[:347]:[ERROR]:Script ended with error [2023-09-24 14:04:34,823]:[ilcbot]:[:348]:[ERROR]:Error: [LoginFailedError] - Failed to login. Incorrect username/password, or 2 factor verification is active. Traceback (most recent call last): File "..\instalike\insta-likecom-bot\ilcbot.py", line 113, in raise LoginFailedError("Failed to login. Incorrect username/password, or 2 factor verification is active.") modules.exceptions.LoginFailedError: Failed to login. Incorrect username/password, or 2 factor verification is active. [2023-09-24 14:04:37,348]:[ilcbot]:[:354]:[INFO]:Total time taken: 11.2059 seconds The password was correct and i do not have 2 factor ver(disabled for using the bot)

What's the version of the script you're using?

version v.3.0.3

shulogsm commented 11 months ago

Same error for me (can´t login), but if i manually accept cookies fast in the browser, i can see the login in browser was done ok and i can see account details, but browser close fast:

modules.exceptions.LoginFailedError: Failed to login. Incorrect username/password, or 2 factor verification is active. [2023-12-03 12:19:34,692]:[ilcbot]:[:154]:[INFO]:Total time taken: 19.1271 seconds [2023-12-03 12:27:13,390]:[ilcbot]:[:44]:[INFO]:Script started [2023-12-03 12:27:13,396]:[ilcbot]:[:45]:[INFO]:Downloading webdriver for your version of Chrome [2023-12-03 12:27:13,408]:[ilcbot]:[:47]:[INFO]:Loading Instagram [2023-12-03 12:27:27,933]:[ilcbot]:[:59]:[INFO]:Delay: 1-10 secs [2023-12-03 12:27:27,939]:[ilcbot]:[:110]:[INFO]:Attempting to log in with UsernameXXX [2023-12-03 12:27:32,444]:[ilcbot]:[:147]:[ERROR]:Script ended with error [2023-12-03 12:27:32,456]:[ilcbot]:[:148]:[ERROR]:Error: [LoginFailedError] - Failed to login. Incorrect username/password, or 2 factor verification is active. Traceback (most recent call last): File "/insta-likecom-bot/ilcbot.py", line 112, in raise LoginFailedError("Failed to login. Incorrect username/password, or 2 factor verification is active.") modules.exceptions.LoginFailedError: Failed to login. Incorrect username/password, or 2 factor verification is active. [2023-12-03 12:27:32,815]:[ilcbot]:[:154]:[INFO]:Total time taken: 19.4248 seconds

shine-jayakumar commented 11 months ago

@shulogsm I need to recreate the issue to be able to fix it. I would need these information:

shulogsm commented 11 months ago

Hi @shine-jayakumar:

I have managed to solve the problem. You are indeed on the right track when you ask me about the language of my browser (Spanish in my case) and the cookies anouncement. To solve the problem, I have played in two different areas:

insta.py:

def validate_login(self) -> bool:
        """
        Validates login
        """
        wait = WebDriverWait(self.driver, 50)
        user_profile_xpaths = [
            **'//img[contains(@alt, "Foto del perfil ")]', // this line was changed to spanish**
            '//div[@class="_acut"]/div/span/img',
            '//img[@data-testid="user-avatar"]'
        ]

On the other hand, I think the cookie ad was also annoying for some reason, so I've added a click to the option that rejects cookies:

 def login(self, validate=True) -> bool:
        """
        Initiates login with username and password
        """
        try:
            self.driver.get(self.baseurl).
            **self.wait.until(EC.presence_of_element_located((By.XPATH, '//button[@class="_a9-- _ap36 _a9_1"]')')).click()
            time.sleep(3) // reject cookies ** 
            self.wait.until(EC.presence_of_element_located((By.XPATH, '//input[@name="username"]'))).send_keys(self.username)
            self.wait.until(EC.presence_of_element_located((By.XPATH, '//input[@name="password"]')')).send_keys(self.password)
            self.wait.until(EC.presence_of_element_located((By.XPATH, '//button[@type="submit"]')))).click()
            time.sleep(4)

Hope this can help to all people here. Thanks for your great work!

shine-jayakumar commented 11 months ago

Hi @shine-jayakumar:

I have managed to solve the problem. You are indeed on the right track when you ask me about the language of my browser (Spanish in my case) and the cookies anouncement. To solve the problem, I have played in two different areas:

insta.py:

def validate_login(self) -> bool:
        """
        Validates login
        """
        wait = WebDriverWait(self.driver, 50)
        user_profile_xpaths = [
            **'//img[contains(@alt, "Foto del perfil ")]', // this line was changed to spanish**
            '//div[@class="_acut"]/div/span/img',
            '//img[@data-testid="user-avatar"]'
        ]

On the other hand, I think the cookie ad was also annoying for some reason, so I've added a click to the option that rejects cookies:

def login(self, validate=True) -> bool:
     """
     Initiates login with username and password
     """
     try:
         self.driver.get(self.baseurl).
         **self.wait.until(EC.presence_of_element_located((By.XPATH, '//button[@class="_a9-- _ap36 _a9_1"]')')).click()
         time.sleep(3) // reject cookies ** 
         self.wait.until(EC.presence_of_element_located((By.XPATH, '//input[@name="username"]'))).send_keys(self.username)
         self.wait.until(EC.presence_of_element_located((By.XPATH, '//input[@name="password"]')')).send_keys(self.password)
         self.wait.until(EC.presence_of_element_located((By.XPATH, '//button[@type="submit"]')))).click()
         time.sleep(4)

Hope this can help to all people here. Thanks for your great work!

Great job @shulogsm 👏

AkhilKiran commented 9 months ago

I'm still getting the same errors and my browser is not in spanish heh.