/pyInstaBot

A Instagram Bot using Deep Learning methods written in Python. PyInstaBot can find interesting people to follow and post new contents on a scheduled time after applying filters.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0


An Instagram bot and library written in Python to publish content automatically.

Join our community ! Chat with us on Gitter and join the Google Group to collaborate with us.

This repository consists of:

  • config : Configuration file management;
  • data :
  • db : MySQL database management;
  • docs : Documentation;
  • executor : Function and objects to execute actions;
  • filters : Function and objects for image filters ;
  • friends : Function and objects to manage friends and followers;
  • hashtags : Function and objects to manage hashtags ;
  • instagram : Function and objects for Instagram ;
  • instagramAPI : The instagram API ;
  • learning : Functions and objects for image and text classification ;
  • media : Functions and objects to manage medias ;
  • patterns : Object patterns ;
  • tools : Tools;

Authors

License

This project is licensed under the GPLv3 License - see the LICENSE file for details.

Configuration

Configuration file

pyInstaBot takes its configuration in a JSON file which looks as follow :

{
    "instagram" :
	{
        "username": "",
        "password": "",
		"data_path": ""
    },
	"scheduler" :
	{
		"sleep": [6, 13]
	},
	"hashtags":
	[
	],
	"friends" :
	{
		"max_new_followers" : 40,
		"max_new_unfollow" : 40,
		"interval" : [30, 45],
		"ratio" : 0.8
	},
	"post":
	{
		"post_interval": [30, 90],
		"like_interval": [0, 4],
		"comment_interval": [0, 8],
        "max_posts": 24,
        "max_likes": 700,
        "max_comments": 300,
		"languages": ["en", "fr"],
		"comments": ["Nice!", "Nice feed!", "Keep going", "Good work", "👊🏻😎", "😅😅😅", "❤❤❤❤", "Nice! 😅😅😅", "Keep going 😅😅😅"]
	},
	"forbidden_words" :
	[
	]
}

Their is two required sections :

  • Database : contains the information to connect to the MySQL database (host, username, password, database)
  • Instagram : contains the information for the Twitter API (auth and access tokens)

Command line

Launch executors

pyInstaBot launch an executor thread for each action type. You can launch the executor daemon that way :

python -m pyInstaBot execute --session session_public.json --config nilsbot.json

Find post to like

To find post to like :

python -m pyInstaBot find-likes --session session_public.json --config nilsbot.json --model .

Find post to comment

To find post to comment :

python -m pyInstaBot find-comments --session session_public.json --config nilsbot.json --model .

Find users to follow

To find new users to follow :

python -m pyInstaBot find-follows --session session_public.json --config nilsbot.json --model .

Find users to unfollow

To find obsolete users to unfollow :

python -m pyInstaBot find-unfollows --session session_public.json --config nilsbot.json --model .

Update friends

To update the list of friends in the database :

python -m pyInstaBot friends --session session_public.json --config nilsbot.json --update

Add medias

To add all medias in a directory with a common caption :

python -m pyInstaBot medias --session session_public.json --config nilsbot.json --add ~/images/ --caption ~/images/caption --loop

The loop argument will repost the medias multiple time. To add only one image :

python -m pyInstaBot medias --session session_public.json --config nilsbot.json --add ~/images/im.jpg --caption ~/images/caption --loop

Development

Files