or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

api-access.mdbot-automation.mdfile-management.mdindex.md
tile.json

tessl/pypi-instabot

Instagram bot scripts for promotion and API python wrapper

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/instabot@0.117.x

To install, run

npx @tessl/cli install tessl/pypi-instabot@0.117.0

index.mddocs/

Instabot

A 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.

Package Information

  • Package Name: instabot
  • Language: Python
  • Installation: pip install instabot
  • Python Support: 2.7, 3.5, 3.6, 3.7

Core Imports

from instabot import Bot, API, utils

Individual component imports:

from instabot.bot import Bot
from instabot.api import API
from instabot.utils import file

Basic Usage

Using the Bot (Recommended)

from 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()

Using the API (Lower-level)

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()

Architecture

Instabot is built on a two-tier architecture:

  • API Layer: Low-level Instagram API wrapper providing direct access to Instagram endpoints with minimal abstraction
  • Bot Layer: High-level automation framework built on top of the API layer, adding safety features, rate limiting, filtering, and batch operations
  • Utilities: File management and helper functions for maintaining bot state and user lists

This design allows developers to choose between direct API control and automated bot functionality while ensuring consistent behavior across both approaches.

Capabilities

Bot Automation

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): ...

Bot Automation

API Access

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=""): ...

API Access

File Management

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): ...

File Management

Types

Configuration Types

# 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
}

Response Types

# 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
    }]
}