Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instagram banned my account #581

Open
helallao opened this issue Feb 18, 2022 · 5 comments
Open

instagram banned my account #581

helallao opened this issue Feb 18, 2022 · 5 comments

Comments

@helallao
Copy link

helallao commented Feb 18, 2022

I made a meme page generator, it just copies posts from my meme pages list but instagram banned my account and deleted all my posts.

Screenshot_20220218-152603_Instagram

I added phone number but my script stopped working for this account

Doesn't this repository use private api?
Why i got banned?
How can i pass this?

code:

from datetime import datetime
import instagrapi
import random
import time
import os



cl = instagrapi.Client()
cl.request_timeout = 5

cl.login('username', 'password')




history = []
copy_list = ['dugunteroru', 'editah4z', 'tassakshitpost', 'boreklipogaca', 'medraxhumor', 'jolithex', 'palanin_mekani', 'igcoplugu', 'the_.green._goblin', 'parttimeejderyaavcisi', 'wiptieyerli']



def clear_files():
    for i in os.listdir('./myfiles/'):
        os.remove(f'./myfiles/{i}')




def send_follow(id):
    for i in cl_2.user_following(cl_2.user_id, 10):
        try:
            cl_2.user_unfollow(i)
            
        except:
            break


    comments = cl_2.media_comments(id)
    
    for i in comments[:10]:
        try:
            id = cl_2.user_id_from_username(i.user.username)
            
            cl_2.user_follow(id)
        
        except:
            break
        
        #follow users from the post comments




def send_post():
    while True:
        page_name = random.choice(copy_list)
        copy_page = cl_2.user_id_from_username(page_name)
        
        post = random.choice(cl_2.user_medias(copy_page, 10))
        
        if post.code not in history:
            history.append(post.code)
            break
        
        #choose a random post from page, and save code to history
    
    
    
    send_follow(post.id)
    
    
    
    if post.media_type == 1:
        try:
            photo = cl_2.photo_download(cl_2.media_pk_from_code(post.code), './myfiles')
            
            cl_2.photo_upload(photo, post.caption_text)
            
            clear_files()
        
        
        except:
            pass
    
    
    
    elif post.media_type == 2 and post.product_type == 'feed':
        try:
            video = cl_2.video_download(cl_2.media_pk_from_code(post.code), './myfiles')
            
            cl_2.video_upload(video, post.caption_text)
            
            clear_files()
        
        
        except:
            pass
    
    
    
    
    elif post.media_type == 2 and post.product_type == 'igtv':
        try:
            igtv = cl_2.igtv_download(cl_2.media_pk_from_code(post.code), './myfiles')
            
            cl_2.igtv_upload(igtv, post.caption_text)
            
            clear_files()
        
        
        except:
            pass
    
    
    
    
    elif post.media_type == 2 and post.product_type == 'clips':
        try:
            clip = cl_2.clip_download(cl_2.media_pk_from_code(post.code), './myfiles')
            
            cl_2.clip_upload(clip, post.caption_text)
            
            clear_files()
        
        
        except:
            pass
    
    
    
    
    elif post.media_type == 8:
        try:
            album = cl_2.album_download(cl_2.media_pk_from_code(post.code), './myfiles')
            
            cl_2.album_upload(album, post.caption_text)
            
            clear_files()
        
        
        except:
            pass





def run():
    while True:
        time.sleep(60 * random.randint(20, 45))
        #sleep 20 ~ 45 minutes
        
        send_post()



run()
@msr8
Copy link

msr8 commented Feb 18, 2022

To get your account unbanned, temporarily give insta your phone number (you can remove it after). And use client.load_settings as shown here

@helallao
Copy link
Author

helallao commented Feb 18, 2022

i edited codes for show here, i was already using client.set_settings(), it's not the real reason of why i got banned.

@Jmallone
Copy link

Jmallone commented Mar 7, 2022

If you only post with your personal account and nothing else, I recommend using the official API, differences:

  • You will not be able to post Stories;
  • Must be a Business account;
  • You have to renew the Token every 3 months, more or less.

I have an account that generates images and I use the official API to post to the feed, and the instagrapi to post to Stories.
And it's been 8 months since everything is going well, maybe it's an alternative for you.

@rehman-00001
Copy link

but using the official API requires facebook to verify/review the app right?

Screenshot 2023-04-08 at 6 34 51 PM

@Jmallone , how did you get past this step?

@diezo
Copy link

diezo commented Jan 8, 2024

This could possibly be because instagrapi doesn't have an auto session management feature and you've logged in a lot of times.

You should try using ensta. While it uses the web api, it stores your previous session locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants