简体   繁体   English

使用 selenium 登录 Instagram 时出现问题,“登录 Instagram 时出现问题”

[英]issue in logging in to Instagram using selenium, 'There was a problem logging you into Instagram'

I am writing a code to scrape Instagram, search and analyze the posts, likes, ... My robot used to work correctly, but from yesterday it cannot login I have tried all of these tricks:我正在编写一个代码来抓取 Instagram,搜索和分析帖子,喜欢,......我的机器人曾经正常工作,但从昨天开始它无法登录我已经尝试了所有这些技巧:

  • logging out from my previous account从我以前的帐户注销
  • using proxies使用代理
  • reset chromwebdriver重置 chromwebdriver

The language I'm using is python libraries:我使用的语言是 python 库:

  1. selenium selenium
  2. beatifulsoup美丽的汤
    def fetch_element(self, by, string):
        res = self.wait.until(EC.visibility_of_element_located((by, string)))
        return res

self.fetch_element(By.NAME, 'username').send_keys(username)
self.fetch_element(By.NAME, 'password').send_keys(password)
self.fetch_element(By.XPATH, '//*[@id="loginForm"]/div/div[3]/button/div').click()
sleep(sleep_instagram)

After a week of struggling I found that Instagram is sensitive to robot activities steps that I have one that has addressed this issue was to: 1- wait for random times经过一周的挣扎后,我发现 Instagram 对机器人活动很敏感,我已经解决了这个问题的步骤是:1-等待随机时间

import numpy as np
sleep_instagram = lambda t: np.random.randint(low=t / 2, high=t * 2, size=1)

2- click on the save login information 2-点击保存登录信息

mine has been solved!!!我的已经解决了!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM