Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- import time
- import random
- from tqdm import tqdm
- import argparse
- sys.path.append(os.path.join(sys.path[0], '../'))
- from instabot import Bot
- bot = Bot(
- proxy=None,
- max_likes_per_day=5000,
- max_unlikes_per_day=0,
- max_follows_per_day=5000,
- max_unfollows_per_day=2000,
- max_comments_per_day=100,
- max_likes_to_like=500,
- filter_users=True,
- filter_business_accounts=False,
- filter_verified_accounts=False,
- max_followers_to_follow=7000,
- min_followers_to_follow=150,
- max_following_to_follow=7500,
- min_following_to_follow=100,
- max_followers_to_following_ratio=2000,
- max_following_to_followers_ratio=2000,
- max_following_to_block=10000,
- min_media_count_to_follow=2,
- like_delay=25,
- unlike_delay=8,
- follow_delay=55,
- unfollow_delay=30,
- comment_delay=60,
- whitelist=False,
- blacklist=False,
- comments_file=False,
- stop_words=["asdnkasdjkfbasjkòdfbòsjkadfòasjkdfbajkòsbdfbòjasdf"]
- )
- def login():
- try:
- bot.login(username='', password='')
- except:
- print('Impossibile effettuare il login,riprovo')
- limite = 800
- def unfollow_cycle():
- with open('followed.txt','r') as file:
- raw = file.read().splitlines()
- file.close()
- try:
- following = bot.get_user_following(bot.user_id)
- except:
- following = bot.get_user_following(bot.user_id)
- defn = [x for x in raw if x in following]
- for user in defn:
- try:
- bot.unfollow(user)
- except:
- bot.unfollow(user)
- def follow_cycle():
- #GET DATAS
- with open('followed.txt','r') as file:
- raw = file.read().splitlines()
- file.close()
- try:
- medias = bot.get_user_medias('mikeisaprettyboy',filtration=False)
- except:
- medias = bot.get_user_medias('mikeisaprettyboy',filtration=False)
- try:
- likers = bot.get_media_likers(medias[0])
- except:
- likers = bot.get_media_likers(medias[0])
- try:
- followers = bot.get_user_followers(bot.user_id)
- except:
- followers = bot.get_user_followers(bot.user_id)
- try:
- following = bot.get_user_following(bot.user_id)
- except:
- following = bot.get_user_following(bot.user_id)
- list = [user for user in likers if not user in followers+following+raw]
- n = len(following)
- delta = limite - n
- #---------
- if delta>50:
- scraped = list[:delta]
- for user in scraped:
- bot.follow(user)
- bot.like_user(user,2)
- else:
- print('Hai raggiunto il limite impostato dal cliente.')
- print('Avvio sleep di 4 ore.')
- time.sleep(60*60*4)
- print('Avvio un ciclo di unfollow.')
- unfollow_cycle()
- login()
- while 1:
- try:
- follow_cycle()
- except:
- print('Qualcosa è andato storto.')
- print('Tra 5 minuti riavvio il modulo.')
- time.sleep(60*5)
- follow_cycle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement