Skip to content

Latest commit

 

History

History
480 lines (405 loc) · 13.4 KB

README.md

File metadata and controls

480 lines (405 loc) · 13.4 KB

insta-likecom-bot

License Open Source Version Issues ClosedIssues Contributors LastCommit TotalCommits contributions welcome

Automates likes and comments on an instagram account or tag

insta-likecom-bot is an instagram bot written in python to automatically like and comment on an account or tag.

Table of Contents

Features

  • Interact with Posts (like, comment, like user comments)
  • Interact with Stories (like, comment)
  • Interact with Reels (like, comment, like user comments) [NEW] [version >= 3.0.4]
  • Like and Comment on posts from followers of an account
  • Softban limit check [NEW] [version >= 3.0.4]
  • Skip posts/reels already commented [NEW] [version >= 3.0.4]
  • Target only stories or reels (skip posts)
  • Specify the number of posts to like
  • Filter post based on tags
  • Filter posts within last n years, months, days, hours, mins, secs
  • Comes loaded with generic comments
  • Load your own comments
  • Comments supports emojis (full support with Firefox; only bmp characters with Chrome)
  • Add a PS to the comments (postscript)
  • Supports Chrome and Firefox
  • Headless mode
  • Supports profile - load parameters from a json file
  • Supports browser profile - save credentials to skip login
  • Target Most Recent posts (Deprecated)
  • Reloading target to view latest posts (Deprecated)

Requirements

  • Python 3
  • Chrome Browser / Firefox

View the requirements.txt

Installation

pip install -r requirements.txt

Options

Required arguments

Argument Description
username Instagram username
password Instagram password
target An instagram account or tag
limits json file defining daily/hourly limits

Optional Arguments

Option Description
-np , --numofposts number of posts to like
-ps , --postscript additional text to add after every comment
-c , --comments file containing comments (one comment per line)
-oc , --onecomment specify only one comment
-nc , --nocomments turn off comments
-sc, --skipcommented skip posts already commented
-lc, --likecomments like top n user comments per post
-ff, --findfollowers like/comment on posts from target's followers
-fa, --followersamount number of followers to process (default=all)
-il, --inlast target post within last n days (default=all) ex. 1y, 2M, 3d, 4h, 53m, 10s
-vs, --viewstory view stories
-ls, --likestory like stories (default=all)
-cs, --commentstory comments on stories (no comments if option not used)
-os, --onlystory target only stories and not posts
-nr, --numofreels number of reels to like
-nrc, --noreelcomments turn off reel comments
-lrc, --likereelcomments like top n user comments per reel
-or, --onlyreels target only reels and not posts
-mr, --mostrecent target most recent posts
-rr, --reloadrepeat reload the target n times (used with -mr)
-mt, --matchtags read tags to match from a file
-mn, --matchtagnum minimum tag match count for post to be qualified
-ma, --matchalltags match all tags in matchtags
-lm, --limits json file with limits configuration
-et , --eltimeout max time to wait for elements to be loaded (default=30)
-d , --delay time to wait while moving from one post to another
-br, --browser browser to use [chrome or firefox] (default=chrome)
-pr, --profile loads profile from a json file
-bp, --brprofile loads chrome profile from a path

Usage

To like and comment every post

ilcbot.py -u yourusername -p yourpassword -t thetarget --limits limits.json

To like and comment on stories

ilcbot.py -u yourusername -p yourpassword -t thetarget -ls -cs 20 -lm limits.json

To like and comment on reels

ilcbot.py -u yourusername -p yourpassword -t thetarget -nr 10 -lm limits.json

To specify number of posts to like

ilcbot.py -u yourusername -p yourpassword -t thetarget -np NOOFPOSTS -lm limits.json

To like and comment on posts from target's followers

ilcbot.py -u yourusername -p yourpassword -t thetarget -np NOOFPOSTS -ff -lm limits.json

To specify a delay

ilcbot.py -u yourusername -p yourpassword -t thetarget -d DELAY -lm limits.json
ilcbot.py -u yourusername -p yourpassword -t thetarget -d start,end -lm limits.json

To specify a file with comments

ilcbot.py -u yourusername -p yourpassword -t thetarget -c FILE -lm limits.json

To specify only one comment

ilcbot.py -u yourusername -p yourpassword -t thetarget -oc TEXT -lm limits.json

To add a text to the end of every comment

ilcbot.py -u yourusername -p yourpassword -t thetarget -ps TEXT -lm limits.json

To leave no comments

ilcbot.py -u yourusername -p yourpassword -t thetarget -nc -lm limits.json

To like comments from other users

ilcbot.py -u yourusername -p yourpassword -t thetarget -ls 5 -lm limits.json

To filter posts within last 2 days

ilcbot.py -u yourusername -p yourpassword -t thetarget -il 2d -lm limits.json

To filter posts within last 5 months

ilcbot.py -u yourusername -p yourpassword -t thetarget -il 5M -lm limits.json

To filter posts within last 3 years

ilcbot.py -u yourusername -p yourpassword -t thetarget -il 3y -lm limits.json

To target most recent posts

ilcbot.py -u yourusername -p yourpassword -t thetarget -mr -lm limits.json

To reload target 5 times with most recent posts

ilcbot.py -u yourusername -p yourpassword -t thetarget -mr -rr 5 -lm limits.json

To filter posts based on tags

ilcbot.py -u yourusername -p yourpassword -t thetarget --matchtags tags.txt -lm limits.json

To specify a browser

ilcbot.py -u yourusername -p yourpassword -t thetarget -br firefox -lm limits.json

To specify a profile

ilcbot.py -pr profile1.json -lm limits.json

To specify a browser profile

ilcbot.py -u yourusername -p yourpassword -t thetarget -bp '/path/to/Profile 1' -lm limits.json

Examples

ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -np 5 -ff -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -np 20 -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t "#haiku" -ps "Follow me @bob101" -c mycomments.txt -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t "#haiku" -oc "Hello there" -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk --delay 5 --numofposts 30 -lm limits.json
ilcbot.py -u 'bob101' -p 'b@bpassw0rd1' -t "#haiku" --delay 2,20 -lm limits.json
ilcbot.py --loadenv --delay 5 --numofposts 10 --headless --nocomments -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -d 5 -np 30 -lc 5 -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -np 30 -il 3h -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -np 30 --matchtags tags.txt --ignoretags ignoretags.txt -lm limits.json
ilcbot.py -pr profile1.json -lm limits.json
ilcbot.py -u bob101 -p b@bpassw0rd1 -t elonmusk -np 30 --brprofile '/path/to/Profile 1' -lm limits.json

Note: Enclose tagnames (#haiku) in double-quotes/single-quotes when running the script in PowerShell/Bash.

ilcbot.py -u bob101 -p b@bpassw0rd1 -t "#haiku" -ps "Follow me @bob101" -c mycomments.txt
ilcbot.py -u 'bob101' -p 'b@bpassw0rd1' -t "#haiku" -ps "Follow me @bob101" -c mycomments.txt

Sample profiles

{   
    "username": "bob01",
    "password":"passw0rd",
    "target": "targets.txt",
    "numofposts": "3",
    "matchtags": "tags.txt",
    "ignoretags": "ignore.txt",
    "comments": "comments.txt",
    "viewstory": true,
    "likestory": 1,
    "inlast": "3d",
    "delay": "5",
    "likecomments": 2,
    "nocomments": true
}
{   
    "username": "bob01",
    "password":"passw0rd",
    "target": ["#haikus", "#photography"],
    "numofposts": "3",
    "matchtags": ["#haiku", "#haikus", "#haikupoetry"],
    "ignoretags": ["#shorts"],
    "comments": "comments.txt",
    "viewstory": true,
    "likestory": 1,
    "inlast": "3d",
    "delay": "5",
    "likecomments": 2,
    "nocomments": true,
    "brprofile" : "/dir/dir1/Profile 1"
}
{   
    "username": "bob01",
    "password":"passw0rd",
    "target": "#photography",
    "numofposts": 2,
    "comments": ["Beautiful!", "Amazing!", "I can relate to this"],
    "delay": "5,20"
}

Sample target files
targets.txt

#haiku
#photography
bob01
elonmusk

Sample file with tags
tagstomatch.txt

#gym
#fitness
#stayfit
#healthylife
#workout

Sample file with comments
comments.txt

🔥🔥🔥
👏👏
Beyond amazing 😍
You’re the goat
This is fire 🔥
Keep grinding 💪
Insane bro 🔥
The shocker! 😮
Such a beauty 😍❤️

Sample limits configuration file
instalimits.json

{
    "daily": {
        "likes": 1000,
        "stories": 1000,
        "story_likes": 600,
        "comment_likes": 1500,
        "accounts": 800,
        "comments": 1000
    },
    "hourly": {
        "likes": 350,
        "accounts": 120,
        "comments": 200
    }
}

Version Updates

Version v.3.0.7 (latest)

Bug Fixes:

  • issue # 119 and issue # 118 (dataclass initiation error while assigining another dataclass as default value)
  • updated locators.py
  • updated locators.json
  • updated is_story_present() method

Version v.3.0.6

Bug Fixes:

  • DOM locators for like, comment, comment disabled updated
  • Issues #118, #119 fixed

Version v.3.0.5

Changes:

  • DOM locators isolated to a .json file
  • Fetches latest version of locators from repo

Bug Fixes:

  • Updated DOM locators for Instagram elements
  • Issue fixed: Skip posts/reels already commented - Doesn't work #113
  • Issue fixed: Unable to interact with Reels #105
  • Issue fixed: Unable To Like And Comment On Stories #104
  • Issue fixed: Error when story comment is disabled #101

Version v.3.0.4

Feature addition:

  • Reels interaction added
  • Softban limit check added
  • Skip already commented posts/reels
  • Persistent stats

Changes:

  • Introduced InstaWorkFlow class
  • Added unit testing
  • Updated Stats class - Auto exit on exceeding limits

Bug Fixes:

  • auto creation of logs directory
  • xpaths for like, Save info buttons updated

Version v.3.0.3

Bug Fixes:

  • Webdriver manager upgraded, enabling script to find latest Chrome drivers
  • XPATH for 'like' button updated

Changes:

  • Using selenium Service class

Version v.3.0.2

Feature addition:

  • Supports Chrome browser profile - saves credentials
  • Supports profiles - loads arguments from a json file
  • Supports multiple targets - accepts file, list, or single value
  • Delay parameter can accept a range (2-20) or single value (20)
  • Ignoretags parameter - skip posts with specific tags present
  • Matchtags, Ignoretags parameter accepts tags from a file, list, or as a single value

Changes:

  • Script renamed to 'ilcbot.py'
  • loadenv parameter deprecated

Version v.2.8

Feature addition:

  • added option -os, --onlystory - target only stories

Bug Fixes:

  • Private account check before opening stories
  • Check if story is present

Version v.2.7

Feature addition:

  • added option -ls, --likestory - to like stories
  • added option -cs, --commentstory - to comment on stories
  • added option -rr, --reloadrepeat - to reload target n times

FAQs


Issue

Report a bug or an issue

LICENSE

MIT

Donations

Buy Me A Coffee