Instagram bot scripts for promotion and API python wrapper
npx @tessl/cli install tessl/pypi-instabot@0.117.0A comprehensive Python library for Instagram automation that provides both low-level API access and high-level bot functionality. Instabot enables developers to create sophisticated Instagram bots with built-in safety features, rate limiting, and extensive filtering capabilities to maintain account security while automating interactions.
pip install instabotfrom instabot import Bot, API, utilsIndividual component imports:
from instabot.bot import Bot
from instabot.api import API
from instabot.utils import filefrom instabot import Bot
# Initialize bot with default settings
bot = Bot()
# Login with credentials
bot.login(username="your_username", password="your_password")
# Upload a photo with caption
bot.upload_photo("path/to/photo.jpg", caption="Hello Instagram! #instabot")
# Like photos from a hashtag
bot.like_hashtag("python", amount=10)
# Follow users from a hashtag
bot.follow_followers("target_username", nfollows=20)
# Print statistics and logout
bot.logout()from instabot import API
# Initialize API
api = API()
# Login
api.login(username="your_username", password="your_password")
# Upload photo
api.upload_photo("path/to/photo.jpg", caption="Hello Instagram!")
# Get user information
user_info = api.get_username_info("target_username")
# Like a media post
api.like("media_id_here")
# Logout
api.logout()Instabot is built on a two-tier architecture:
This design allows developers to choose between direct API control and automated bot functionality while ensuring consistent behavior across both approaches.
High-level Instagram bot with comprehensive automation features, safety filters, rate limiting, and batch operations. Includes smart targeting, content filtering, and user management capabilities.
class Bot:
def __init__(self, base_path=current_path + "/config/", proxy=None,
max_likes_per_day=random.randint(50, 100),
filter_users=False, **config): ...
def login(self, username=None, password=None, **args): ...
def logout(self): ...
def upload_photo(self, photo, caption=None, **options): ...
def like_hashtag(self, hashtag, amount=None): ...
def follow_followers(self, user_id, nfollows=None): ...
def unfollow_non_followers(self, n_to_unfollows=None): ...Low-level Instagram API wrapper providing direct access to Instagram endpoints with authentication, media management, user interactions, and feed operations.
class API:
def __init__(self, device=None, base_path=current_path + "/config/",
save_logfile=True, **config): ...
def login(self, username=None, password=None, force=False, **options): ...
def logout(self): ...
def upload_photo(self, photo, caption=None, **options): ...
def like(self, media_id, **options): ...
def follow(self, user_id): ...
def get_user_feed(self, user_id, max_id=""): ...Utility classes for managing user lists, blacklists, whitelists, and bot state persistence with support for file-based storage and duplicate management.
class file:
def __init__(self, fname, verbose=True): ...
def append(self, item, allow_duplicates=False): ...
def remove(self, x): ...
def random(self): ...
def __iter__(self): ...
def __len__(self): ...
@property
def list(self): ...
@property
def set(self): ...# Bot configuration parameters
BotConfig = {
'max_likes_per_day': int,
'max_follows_per_day': int,
'max_unfollows_per_day': int,
'max_comments_per_day': int,
'whitelist_file': str,
'blacklist_file': str,
'followed_file': str,
'proxy': str,
# ... extensive additional configuration options
}
# API configuration parameters
APIConfig = {
'device': str,
'base_path': str,
'save_logfile': bool,
'log_filename': str,
'proxy': str
}# User information response
UserInfo = {
'user': {
'pk': int,
'username': str,
'full_name': str,
'profile_pic_url': str,
'follower_count': int,
'following_count': int,
'media_count': int,
'is_private': bool,
'is_verified': bool
}
}
# Media information response
MediaInfo = {
'items': [{
'id': str,
'code': str,
'media_type': int,
'image_versions2': dict,
'video_versions': list,
'caption': dict,
'like_count': int,
'comment_count': int,
'user': dict
}]
}