Alpine version of https://github.com/timgrossmann/InstaPy for deployment in Swarm
50K+
Implemented in Python using the Selenium module.
Think this tool is worth supporting? Head over to https://github.com/timgrossmann/InstaPy/wiki/How-to-Contributeβ to find out how you can help. Become a part of InstaPy!
Have an issue? Head over to https://github.com/timgrossmann/InstaPy/wiki/Reporting-An-Issueβ to find out how to report this to us and get help.
Disclaimer: Please Note that this is a research project. I am by no means responsible for any usage of this tool. Use on your own behalf. I'm also not responsible if your accounts get banned due to extensive use of this tool.
Talk about automating your Instagramβ | Talk about doing Open-Source workβ |Β Listen to the "Talk Python to me"-Episodeβ
β
β
Setting up InstaPy for MacOS using Firefoxβ
Setting up InstaPy at Digital Ocean (for Debian)β
Setting up InstaPy for Windowsβ
How to Ubuntu (64-Bit)β Β Β Β Β Β Β
How to RaspberryPiβ Β Β Β Β Β Β
1. git clone https://github.com/timgrossmann/InstaPy.git
2. cd InstaPy
3. pip install .
or
3. python setup.py install
chromedriver for your system from hereβ . Extract the .zip file and put it in /assets folder.The best way to install InstaPy is to create a virtual enviornment, install InstaPy there and run it from a separate file:
1. git clone https://github.com/timgrossmann/InstaPy.git
2. cd InstaPy
3. python3 -m venv venv
4. source venv/bin/activate
5. pip install .
1. git clone https://github.com/timgrossmann/InstaPy.git
2. cd InstaPy
3. python3 -m venv venv
4. venv\Scripts\activate.bat
5. pip install .
If you're not familiar with venv, please read about it hereβ and use it to your advantage.
Running source venv/bin/activate will activate the correct Python to run InstaPy. To exit an activated venv run deactivate.
Now, copy/paste the quickstart.py Python code below and run your first InstaPy script. Remember to run it with Python from the venv. To make sure which Python is used, run which python, it will tell you which Python is 'active'.
Whenever you run the script, the virtual enviornment must be active.
1. virtualenv venv
2. source venv/bin/activate
3. pip install git+https://github.com/timgrossmann/InstaPy.git
If you're not familiar with virtualenv, please read about it hereβ and use it to your advantage.
In essence, this is be the only Python library you should install as root (e.g., with sudo). All other Python libraries should be inside a virtualenv.
Running source venv/bin/activate will activate the correct Python to run InstaPy. To exit an activated virtualenv run deactivate.
Now, copy/paste the quickstart.py Python code below and run your first InstaPy script. Remember to run it with Python from the virtualenv, so from venv/bin/python. To make sure which Python is used, run which python, it will tell you which Python is 'active'.
Basic setup is a good way to test the tool. At project root folder open quickstart.py and update with your username and password.
from instapy import InstaPy
from instapy.util import smart_run
# login credentials
insta_username = ''
insta_password = ''
# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=False)
with smart_run(session):
""" Activity flow """
# settings
session.set_relationship_bounds(enabled=True,
delimit_by_numbers=True,
max_followers=4590,
min_followers=45,
min_following=77)
session.set_dont_include(["friend1", "friend2", "friend3"])
session.set_dont_like(["pizza", "#store"])
# actions
session.like_by_tags(["natgeo"], amount=10)
Execute it:
$ python quickstart.py
1. Session scheduling with Telegramβ
# default enabled=False, ~ every 4th image will be commented on
session.set_do_comment(enabled=True, percentage=25)
session.set_comments(['Awesome', 'Really Cool', 'I like your stuff'])
# you can also set comments for specific media types (Photo / Video)
session.set_comments(['Nice shot!'], media='Photo')
session.set_comments(['Great Video!'], media='Video')
# and you can add the username of the poster to the comment by using
session.set_comments(['Nice shot! @{}'], media='Photo')
# default enabled=False, follows ~ 10% of the users from the images, times=1
# (only follows a user once (if unfollowed again))
session.set_do_follow(enabled=True, percentage=10, times=2)
follow_by_list(followlist=['samantha3', 'larry_ok'], times=1, sleep_delay=600, interact=False)
only follows a user once (if unfollowed again) would be useful for the precise targeting
sleep_delay is used to define break time after some good following (averagely ~10 follows)
For example, if one needs to get followbacks from followers of a chosen account/group of accounts.
accs = ['therock','natgeo']
session.follow_by_list(accs, times=1, sleep_delay=600, interact=False)
interact=True which will use the configuration of set_user_interact setting:session.set_user_interact(amount=4,
percentage=50,
randomize=True,
media='Photo')
session.follow_by_list(followlist=['samantha3', 'larry_ok'], times=2, sleep_delay=600, interact=True)
# Follows the followers of each given user
# The usernames can be either a list or a string
# The amount is for each account, in this case 30 users will be followed
# If randomize is false it will pick in a top-down fashion
session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False)
# default sleep_delay=600 (10min) for every 10 user following, in this case
# sleep for 60 seconds
session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, sleep_delay=60)
Note: simulationβ takes place while running this feature.
# Follows the people that a given users are following
# The usernames can be either a list or a string
# The amount is for each account, in this case 30 users will be followed
# If randomize is false it will pick in a top-down fashion
session.follow_user_following(['friend1', 'friend2', 'friend3'], amount=10, randomize=False)
# default sleep_delay=600 (10min) for every 10 user following, in this case
# sleep for 60 seconds
session.follow_user_following(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, sleep_delay=60)
Note: simulationβ takes place while running this feature.
# For 50% of the 30 newly followed, move to their profile
# and randomly choose 5 pictures to be liked.
# Take into account the other set options like the comment rate
# and the filtering for inappropriate words or users
session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, interact=True)
# Follow user based on hashtags (without liking the image)
session.follow_by_tags(['tag1', 'tag2'], amount=10)
session.follow_likers (['user1' , 'user2'], photos_grab_amount = 2, follow_likers_per_photo = 3, randomize=True, sleep_delay=600, interact=False)
in this case 2 random photos from each given user will be analyzed and 3 people who liked them will be followed, so 6 follows in total
The usernames can be any list
The photos_grab_amount is how many photos will I grat from users profile and analyze who liked it
The follow_likers_per_photo is how many people to follow per each photo
randomize=False will take photos from newes, true will take random from first 12
sleep_delay is used to define break time after some good following (averagely ~10 follows)
interact=True which will use the configuration of set_user_interact setting:session.set_user_interact(amount=2,
percentage=70,
randomize=True,
media='Photo')
session.follow_likers (['user1' , 'user2'], photos_grab_amount = 2, follow_likers_per_photo = 3, randomize=True, sleep_delay=600, interact=True)
session.follow_commenters(['user1', 'user2', 'user3'], amount=100, daysold=365, max_pic = 100, sleep_delay=600, interact=False)
in this case (max 100 newest photos & maximum 365 days old) from each given user will be analyzed and 100 people who commented the most will be followed
The usernames can be any list
The amount is how many people to follow
The daysold will only take commenters from photos no older than daysold days
The max_pic will limit number of photos to analyze
sleep_delay is used to define break time after some good following (averagely ~10 follows)
interact=True which will use the configuration of set_user_interact setting:session.set_user_interact(amount=3,
percentage=32,
randomize=True,
media='Video')
session.follow_commenters(['user1', 'user2', 'user3'], amount=100, daysold=365, max_pic = 100, sleep_delay=600, interact=True)
# Interact with specific users
# set_do_like, set_do_comment, set_do_follow are applicable
session.set_do_follow(enabled=False, percentage=50)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)
session.set_do_like(True, percentage=70)
session.interact_by_users(['user1', 'user2', 'user3'], amount=5, randomize=True, media='Photo')
# Interact with specific users' tagged posts
# set_do_like, set_do_comment, set_do_follow are applicable
session.set_do_follow(enabled=False, percentage=50)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)
session.set_do_like(True, percentage=70)
session.interact_by_users_tagged_posts(['user1', 'user2', 'user3'], amount=5, randomize=True, media='Photo')
# Interact with the people that a given user is following
# set_do_comment, set_do_follow and set_do_like are applicable
session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
session.set_do_follow(enabled=False, percentage=70)
session.set_do_like(enabled=False, percentage=70)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)
session.interact_user_following(['natgeo'], amount=10, randomize=True)
Note: simulationβ takes place while running this feature.
# Interact with the people that a given user is followed by
# set_do_comment, set_do_follow and set_do_like are applicable
session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
session.set_do_follow(enabled=False, percentage=70)
session.set_do_like(enabled=False, percentage=70)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)
session.interact_user_followers(['natgeo'], amount=10, randomize=True)
Note: simulationβ takes place while running this feature.
session.interact_by_URL(urls=["some/URL/1", "some/URL/2" "other/URL"], randomize=True, interact=True)
To use, define all of the interaction settings and start the feature right away!
#define interaction settings
session.set_do_like(enabled=True, percentage=94)
session.set_do_comment(enabled=True, percentage=24)
session.set_comments(["Masterful shot", "Chilling!", "Unbelievably great..."])
session.set_do_follow(enabled=True, percentage=44)
session.set_user_interact(amount=6, randomize=True, percentage=72, media='Photo')
#start the feature
session.interact_by_URL(urls=["Fv0J4AJ3Y7r/?taken-at=628416252", "Vb0D4bJgY7r" "Dj0J4VJgY7r"], randomize=True, interact=True)
urls:
Contains the URLs of the posts to be interacted.
"https://www.IG.com/p/Aj0J4bJDY7r/?taken-at=128316221""https://www.IG.com/p/Aj0J4bJDY7r/""Aj0J4bJDY7r/?taken-at=128316221""Aj0J4bJDY7r"randomize:
Shuffles the order of the URLs in the given list before starts to interact.
interact:
Use it if you like to also interact the post owner after doing interactions on the post itself.
session.interact_by_comments(usernames=["somebody", "other buddy"],
posts_amount=10,
comments_per_post=5,
reply=True,
interact=True,
randomize=True,
media="Photo")
usernames
: A list containing the usernames of users on WHOSE posts' comments will be interacted;
posts_amount
: Number of the posts to get from each user for interacting by comments;
comments_per_post
: Choose how many comments to interact (like and then reply) on each post;
reply
: Choose if it should reply to comments;
interact
: Use if you also like to interact the commenters after finishing liking (and then replying to) comments on the post;
randomize
: Shuffles the order of the posts from users' feed and comments in the given post;
media
: Choose the type of media to be interacted - "Photo" for photos, "Video" for videos, None for any media;
To use, set replying and interaction configuration(s)
session.set_do_reply_to_comments(enabled=True, percentage=14)
session.set_comment_replies(replies=[u"πππ", u"ππππππππͺπΌ", u"ππ", "ππ¬", u"πππππΌππΌππΌ", u"πππΌββοΈππππ", u"πππ", u"π", u"π", u"π", u"π€π€π€π€π€", u"ππΌπ"],
media="Photo")
session.set_user_interact(amount=2, percentage=70, randomize=False, media="Photo")
# also configure [at least] liking to be used while interacting with the commenters ...
session.set_do_like(enabled=True, percentage=94)
# start the feature
session.interact_by_comments(usernames=["somebody", "other.buddy"], posts_amount=10, comments_per_post=5, reply=True, interact=True, randomize=True, media="Photo")
Note: To be able to reply to comments, you have to turn on text analytics- Yandexβ & MeaningCloudβ .
So that they will analyze the content of comments and if it is appropriate, will send a reply to the comment.
To configure those text analytics, see the usage in their sections.
There are 3 COMBINATIONS available to use regarding text analysis:
a-) ONLY Sentiment Analysis;
MeaningCloud must be turned on and Yandex must be enabled with a valid API key,
session.set_use_meaningcloud(enabled=True, license_key='', polarity="P")
session.set_use_yandex(enabled=True, API_key='')
b-) ONLY Language Match; Yandex must be turned on,
session.set_use_yandex(enabled=True, API_key='', match_language=False, language_code="en")
c-) BOTH Sentiment Analysis and Language Match; MeaningCloud and Yandex must be turned on,
session.set_use_meaningcloud(enabled=True, license_key='', polarity="P")
session.set_use_yandex(enabled=True, API_key='', match_language=True, language_code="en")
If you have followed any of those 3 text analysis combinations:
It will first analyze comments' content and if it is appropriate, then it will first like, then will reply to it.
All those inappropriate comments will neither be liked, nor replied to.
If you have not followed any of those 3 text analysis combinations OR misconfigured them:
Comments' content will not be able to be analyzed and that's why no any comments will be replied.
Yet, it will like all of the comments that are available.
In conclusion, the whole block SHOULD look like this,
session.set_use_meaningcloud(enabled=True, license_
Content type
Image
Digest
Size
182.9 MB
Last updated
almost 8 years ago
docker pull funkypenguin/instapy