MonitorAPI¶
ig.monitor— Real-time account monitoring with callbacks for follower changes, new posts, bio updates, and more.
Quick Example¶
ig = Instagram.from_env()
watcher = ig.monitor.watch("cristiano")
watcher.on_new_post(lambda data: print(f"New post: {data}"))
watcher.on_follower_change(lambda old, new: print(f"Followers: {old:,} → {new:,}"))
watcher.on_bio_change(lambda old, new: print(f"Bio: '{old}' → '{new}'"))
ig.monitor.start(interval=300) # Check every 5 minutes
Methods¶
watch(username)¶
Start watching an account. Returns an AccountWatcher instance.
| Param | Type | Required | Description |
|---|---|---|---|
username |
str |
✅ | Account to monitor |
Returns: AccountWatcher
AccountWatcher Callbacks¶
watcher = ig.monitor.watch("nike")
watcher.on_new_post(callback) # New post detected
watcher.on_follower_change(callback) # Follower count changed
watcher.on_bio_change(callback) # Biography changed
watcher.on_story_update(callback) # New story
All callbacks support chaining:
start(interval=60)¶
Start the monitoring background thread.
| Param | Type | Default | Description |
|---|---|---|---|
interval |
int |
60 | Seconds between checks |
stop()¶
Stop monitoring.
unwatch(username)¶
Remove an account from monitoring.
get_stats()¶
Get monitoring statistics.