Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. import sys
  2. import os
  3. import time
  4. import random
  5. from tqdm import tqdm
  6. import argparse
  7.  
  8. sys.path.append(os.path.join(sys.path[0], '../'))
  9. from instabot import Bot
  10.  
  11. bot = Bot(
  12. proxy=None,
  13. max_likes_per_day=5000,
  14. max_unlikes_per_day=0,
  15. max_follows_per_day=5000,
  16. max_unfollows_per_day=2000,
  17. max_comments_per_day=100,
  18. max_likes_to_like=500,
  19. filter_users=True,
  20. filter_business_accounts=False,
  21. filter_verified_accounts=False,
  22. max_followers_to_follow=7000,
  23. min_followers_to_follow=150,
  24. max_following_to_follow=7500,
  25. min_following_to_follow=100,
  26. max_followers_to_following_ratio=2000,
  27. max_following_to_followers_ratio=2000,
  28. max_following_to_block=10000,
  29. min_media_count_to_follow=2,
  30. like_delay=25,
  31. unlike_delay=8,
  32. follow_delay=55,
  33. unfollow_delay=30,
  34. comment_delay=60,
  35. whitelist=False,
  36. blacklist=False,
  37. comments_file=False,
  38. stop_words=["asdnkasdjkfbasjkòdfbòsjkadfòasjkdfbajkòsbdfbòjasdf"]
  39. )
  40. def login():
  41. try:
  42. bot.login(username='', password='')
  43. except:
  44. print('Impossibile effettuare il login,riprovo')
  45. limite = 800
  46.  
  47.  
  48.  
  49. def unfollow_cycle():
  50. with open('followed.txt','r') as file:
  51. raw = file.read().splitlines()
  52. file.close()
  53. try:
  54. following = bot.get_user_following(bot.user_id)
  55. except:
  56. following = bot.get_user_following(bot.user_id)
  57. defn = [x for x in raw if x in following]
  58. for user in defn:
  59. try:
  60. bot.unfollow(user)
  61. except:
  62. bot.unfollow(user)
  63.  
  64.  
  65.  
  66. def follow_cycle():
  67. #GET DATAS
  68. with open('followed.txt','r') as file:
  69. raw = file.read().splitlines()
  70. file.close()
  71.  
  72. try:
  73. medias = bot.get_user_medias('mikeisaprettyboy',filtration=False)
  74. except:
  75. medias = bot.get_user_medias('mikeisaprettyboy',filtration=False)
  76.  
  77. try:
  78. likers = bot.get_media_likers(medias[0])
  79. except:
  80. likers = bot.get_media_likers(medias[0])
  81.  
  82. try:
  83. followers = bot.get_user_followers(bot.user_id)
  84. except:
  85. followers = bot.get_user_followers(bot.user_id)
  86.  
  87. try:
  88. following = bot.get_user_following(bot.user_id)
  89. except:
  90. following = bot.get_user_following(bot.user_id)
  91.  
  92. list = [user for user in likers if not user in followers+following+raw]
  93. n = len(following)
  94. delta = limite - n
  95. #---------
  96. if delta>50:
  97. scraped = list[:delta]
  98. for user in scraped:
  99. bot.follow(user)
  100. bot.like_user(user,2)
  101. else:
  102. print('Hai raggiunto il limite impostato dal cliente.')
  103. print('Avvio sleep di 4 ore.')
  104. time.sleep(60*60*4)
  105. print('Avvio un ciclo di unfollow.')
  106. unfollow_cycle()
  107.  
  108. login()
  109. while 1:
  110. try:
  111. follow_cycle()
  112. except:
  113. print('Qualcosa è andato storto.')
  114. print('Tra 5 minuti riavvio il modulo.')
  115. time.sleep(60*5)
  116. follow_cycle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement