instagrapi icon indicating copy to clipboard operation
instagrapi copied to clipboard

[BUG] Suspicious activity

Open Rain1950 opened this issue 2 years ago • 5 comments

Describe the bug Basically instagram detects suspicious activity on my account anytime i post anything. I need to verify my email after each posting session.

To Reproduce `from genericpath import exists from time import sleep from instagrapi import Client import os from PIL import Image

files = os.listdir("Resources/Temp/")

if files != None: with open("Resources/login.txt","r") as f: Login = f.readlines()[0] f.close() with open("Resources/test.txt","r") as f: Password = f.readlines()[0] f.close()
cl = Client() sleep(10) cl.login(Login,Password) for file in files: sleep(10) image = Image.open("Resources/Temp/" + file) if image.size[0] > image.size[1]: image = image.resize((image.size[1],image.size[1])) else: image = image.resize((image.size[0],image.size[0]))
Converted_image = image.convert("RGB") Converted_image.save("Resources/Temp/" + "Resized" + file.replace("png","jpg") ) os.remove("Resources/Temp/" + file) cl.photo_upload("Resources/Temp/" + "Resized" +file.replace("png","jpg"),caption= u"😅") os.remove("Resources/Temp/" + "Resized" + file.replace("png","jpg") )
`

Traceback there isn't

Expected behavior Well it was working for months but now it seems that instagram figured out that something is wrong. It's just really boring to verify email each time my bot posts on my account.

Screenshots Can't provide that rn but i will if it will be needed.

Desktop (please complete the following information):

  • OS: [Windows 10 latest]
  • Python version [latest(probably doesnt matter)]
  • instagrapi version [1.13.3]

Rain1950 avatar May 30 '22 21:05 Rain1950

Login in the app, try again.

kingbotss avatar May 31 '22 05:05 kingbotss

Login in the app, try again.

What do you mean? I'm logging in everyday.

Rain1950 avatar May 31 '22 20:05 Rain1950

You should not fresh login every time you run the script.

I recommend you to save session settings in a file, and use it for your next session.

import instagrapi
import json
import os

if 'session.json' in os.listdir():
    with open('session.json', 'r') as f:
        cl_session = json.load(f)
else:
    cl_session =  {}

cl = instagrapi.Client(cl_session)
cl.login(username, password)

with open('session.json', 'w') as f:
    json.dump(cl.get_settings(), f)

Be aware that this session.json file permit anyone to login to your account. Keep it safe.

ghrlt avatar Jun 01 '22 07:06 ghrlt

@ghrlt try to use cl.load_settings and cl.dump_settings https://adw0rd.github.io/instagrapi/usage-guide/interactions.html

adw0rd avatar Jun 01 '22 08:06 adw0rd

Okay thanks this seems to be working. Sorry for causing a trouble!

Rain1950 avatar Jun 01 '22 14:06 Rain1950