Unfollows accounts from a provided list on Instagram, with influencer filtering and live logging.
Project description
insta-pruner
A Python library to automatically unfollow non-followers on Instagram, with influencer filtering and live logging.
Connects to your already-open, logged-in Chrome browser — no credentials stored, no login automation.
📦 Installation
pip install insta-pruner
🚀 Quick Start
Using a file
from insta_pruner import Pruner
pruner = Pruner(
usernames_file="non_followers.txt",
threshold=5000,
inactive_months=6
)
pruner.run()
Using a list directly
from insta_pruner import Pruner
pruner = Pruner(
usernames=["user1", "user2", "user3"],
threshold=3000,
inactive_months=3
)
pruner.run()
⚙️ Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
usernames_file |
str |
None |
Path to .txt file with one username per line |
usernames |
list |
None |
Pass usernames directly as a Python list |
threshold |
int |
5000 |
Accounts with ≥ this many followers are kept (influencer filter) |
inactive_months |
int |
6 |
Unfollow if no post or reel within this many months |
unfollowed_log |
str |
unfollowed.txt |
File to log unfollowed accounts (appended, never overwritten) |
kept_log |
str |
kept_following.txt |
File to log kept accounts (appended, never overwritten) |
debugging_port |
int |
9222 |
Chrome remote debugging port |
pause_before_check |
int |
4 |
Seconds to wait for each profile page to load |
pause_between_users |
int |
2 |
Seconds to wait between processing each user |
Either
usernames_fileorusernamesmust be provided. If both are given,usernamestakes priority.
💻 Before Running
You must start Chrome with remote debugging enabled so the library can connect to your logged-in session.
PowerShell:
Start-Process "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList "--remote-debugging-port=9222", "--user-data-dir=C:\chrome-debug"
CMD:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\chrome-debug"
macOS:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
Then log in to Instagram in that Chrome window, and run your Python script.
📏 Unfollow Rules
The usernames list is expected to be non-followers (people who don’t follow you back). The library then applies:
- Influencer filter — accounts with followers ≥
thresholdare always kept - Inactivity filter — accounts with no posts or reels in the last
inactive_monthsare unfollowed - Both posts (
/p/) and reels (/reel/) are checked for last activity
📄 Log Files
Both log files are appended to on every run — previous data is never deleted. Each run is separated by a clear divider:
# UNFOLLOWED ACCOUNTS
# ===========================================================================
# Run started 2026-06-14 19:00:00
# ===========================================================================
# username followers last_active reason
# ---------------------------------------------------------------------------
@some_account 320 2023-05-10 followers < 5,000 | last active 2023-05-10 (inactive)
# ===========================================================================
# NEW RUN — 2026-06-15 10:00:00
# ===========================================================================
# username followers last_active reason
# ---------------------------------------------------------------------------
@another_account 150 N/A followers < 5,000 | no posts/reels found
⚠️ Notes
- Chrome must be open and logged in to Instagram before calling
pruner.run() - Instagram may rate-limit your account if you process too many users too quickly — increase
pause_between_usersif needed - Private accounts with hidden posts/reels will show last activity as
N/Aand will be unfollowed if below the threshold - This library uses Selenium to automate browser actions — use responsibly
🧑💻 Author
Rahul S R — github.com/officialsrrahul
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file insta_pruner-0.1.2.tar.gz.
File metadata
- Download URL: insta_pruner-0.1.2.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f91b5bebd02009525691dfe54b24101817b165165bdedad121d5253695ad27
|
|
| MD5 |
403f31bf8ea9f1f468e6c47a8937bb6c
|
|
| BLAKE2b-256 |
dbe3ecef6fe8579b7e3661a7b161e7912797a8dda3569ef4b36f662ad2fcb0ce
|
Provenance
The following attestation bundles were made for insta_pruner-0.1.2.tar.gz:
Publisher:
publish.yml on officialsrrahul/insta_pruner_package
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
insta_pruner-0.1.2.tar.gz -
Subject digest:
f0f91b5bebd02009525691dfe54b24101817b165165bdedad121d5253695ad27 - Sigstore transparency entry: 1818683917
- Sigstore integration time:
-
Permalink:
officialsrrahul/insta_pruner_package@5475a124483553019409c5c4305c30657ed860b4 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/officialsrrahul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5475a124483553019409c5c4305c30657ed860b4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file insta_pruner-0.1.2-py3-none-any.whl.
File metadata
- Download URL: insta_pruner-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1efa9eee82c7e12a6b43df2b79871748579b6768dc3628a28fb78aaea0c2179
|
|
| MD5 |
f55466ccd239a758552a249b53c99072
|
|
| BLAKE2b-256 |
0142f112188daa301a40e0c1a34c0c2a12a7c21ac1e8931a672338e9562a5c5e
|
Provenance
The following attestation bundles were made for insta_pruner-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on officialsrrahul/insta_pruner_package
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
insta_pruner-0.1.2-py3-none-any.whl -
Subject digest:
e1efa9eee82c7e12a6b43df2b79871748579b6768dc3628a28fb78aaea0c2179 - Sigstore transparency entry: 1818683928
- Sigstore integration time:
-
Permalink:
officialsrrahul/insta_pruner_package@5475a124483553019409c5c4305c30657ed860b4 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/officialsrrahul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5475a124483553019409c5c4305c30657ed860b4 -
Trigger Event:
release
-
Statement type: