Skip to content

Instantly share code, notes, and snippets.

@ohld
Created August 28, 2019 20:03
Show Gist options
  • Select an option

  • Save ohld/08682ea30bb41cf5b1c512d5fcf68379 to your computer and use it in GitHub Desktop.

Select an option

Save ohld/08682ea30bb41cf5b1c512d5fcf68379 to your computer and use it in GitHub Desktop.
Like the likers of my Instagram likers
import os
import time
import random
from instabot import Bot
def like_media_likers(bot, media, nlikes=2):
for user in bot.get_media_likers(media):
bot.like_user(user, nlikes)
return True
bot = Bot()
bot.login(
username=os.getenv("INSTAGRAM_USERNAME"),
password=os.getenv("INSTAGRAM_PASSWORD"),
)
my_last_medias = bot.get_your_medias()
random.shuffle(my_last_medias)
for media in my_last_medias:
my_last_media_likers = bot.get_media_likers(media)
random.shuffle(my_last_media_likers)
for user in my_last_media_likers:
user_medias = bot.get_user_medias(user)
random.shuffle(user_medias)
for m in user_medias:
like_media_likers(bot, m)
time.sleep(random.random() * 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment