insta-likecom-bot: Can't login

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 <module> 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 `

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

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!

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 👏