Guest User

Untitled

a guest
Mar 3rd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. from instapy import InstaPy
  2. from random import sample, randint
  3.  
  4. insta_username = ''
  5. insta_password = ''
  6.  
  7. # set headless_browser=True if you want to run InstaPy on a server
  8. try:
  9. session = InstaPy(username=insta_username,
  10. password=insta_password,
  11. headless_browser=False)
  12. session.login()
  13.  
  14. def get_like_n_times():
  15. return randint(20, 35)
  16.  
  17. def get_unfollow_n_times():
  18. return randint(20, 30)
  19.  
  20. def get_follow_n_times():
  21. return randint(25, 40)
  22.  
  23. def get_random_sleep_delay():
  24. return randint(45, 140)
  25.  
  26. # settings
  27. tags = [
  28. 'deporte', 'entrenamiento', 'vidasana', 'ejercicio', 'correr',
  29. 'entrenar', 'salud', 'nutricion', 'triatlon', 'juegosolimpicos',
  30. 'gimnasio', 'motivacion', 'deportes', 'adelgazar', 'reto',
  31. 'ejercicios', 'vidasaludable', 'bienestar', 'saludable', 'olimpiadas',
  32. 'barranquilla', 'ejercicio', 'entrenamiento', 'entrenar', 'adelgazar',
  33. 'salud', 'bajardepeso', 'gimnasio', 'sentadillas', 'vidasana',
  34. 'abdominales', 'cuerpo', 'resultados', 'saludable', 'vidasaludable',
  35. 'belleza', 'baby', 'familia'
  36. ]
  37.  
  38. competitors = [
  39. 'territorio27', 'policortez'
  40. ]
  41.  
  42. # select 3 tags from the tags list
  43. tags = sample(set(tags), 3)
  44.  
  45. # actions
  46. # this setting is to avoid unused accounts
  47. # (profile with less than 100 followers)
  48. session.set_lower_follower_count(limit=100)
  49. session.set_do_follow(enabled=True, percentage=35, times=1)
  50. session.like_by_tags(tags, amount=get_like_n_times())
  51. session.unfollow_users(amount=get_unfollow_n_times(),
  52. onlyNotFollowMe=True,
  53. sleep_delay=get_random_sleep_delay())
  54. session.follow_user_followers(competitors,
  55. amount=get_follow_n_times(),
  56. random=True)
  57. # active it in next week or if you´re running the bot less than
  58. # 3 times a day
  59. '''
  60. session.like_by_tags(tags, amount=get_like_n_times())
  61. session.unfollow_users(amount=get_unfollow_n_times(),
  62. onlyNotFollowMe=True,
  63. sleep_delay=get_random_sleep_delay())
  64. session.follow_user_followers(competitors,
  65. amount=get_follow_n_times(),
  66. random=True)
  67. '''
  68. session.end()
  69.  
  70. finally:
  71. # end the bot session
  72. session.end()
Add Comment
Please, Sign In to add comment