Rewrite tracker with instagrapi and snapshot-based diffing - #23
Open
Silverarmor wants to merge 3 commits into
Open
Rewrite tracker with instagrapi and snapshot-based diffing#23Silverarmor wants to merge 3 commits into
Silverarmor wants to merge 3 commits into
Conversation
Replace the dead instaclient/Selenium implementation with a single tracker.py supporting two data sources: - scrape (default): instagrapi private mobile API with cached device session, 2FA support, randomised request delays, and challenge handling - export: parse Instagram's official 'Download your information' export (zip or folder) for a zero-ban-risk alternative Daily snapshots are stored as dated JSON under data/; each run diffs against the previous snapshot and posts the four change categories to a Discord webhook using the same embed titles/colours as v1. Empty scrapes abort without saving so a bad run can't poison the next diff. README documents the current (2026) scraping options, their ToS status, and bot-detection tradeoffs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NW36HHEBk3eCps3Lrb2qsr
Optionally append one row per run (counts, the four change lists, and the full follower/following lists) to a Google Sheet via a gspread service account. If the local data/ directory is lost (dead SD card, reinstall), the next run rebuilds its diff baseline from the sheet's last row instead of starting over, so change detection stays continuous. Sheets failures degrade to a webhook warning rather than failing the run, and dry-run mode never writes to the sheet. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NW36HHEBk3eCps3Lrb2qsr
A missing data/ directory now just starts a fresh baseline by default. Restoring the diff baseline from the Google Sheet's last row is an explicit recovery action: it requires the Sheets backup to be configured, refuses to run when local snapshots already exist, and fails loudly when the sheet has no data rows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NW36HHEBk3eCps3Lrb2qsr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete rewrite of the Instagram follower/following tracker, replacing the abandoned
instaclient/Selenium stack withinstagrapiand a snapshot-based architecture. The new version is more reliable, maintainable, and offers multiple data sources.Key Changes
Replaced
insta.pywithtracker.py: New single-entry-point script with cleaner architectureinstaclient(unmaintained) and Seleniuminstagrapi(actively maintained private mobile API)Snapshot-based diffing:
data/snapshot-YYYY-MM-DD.jsonDual data sources:
--source scrape(default): Usesinstagrapito log in and fetch lists--source export: Parses official Instagram data exports (zero ban risk, manual process)Improved session handling:
session.json) instead of fresh login each run--2faflag for non-interactive runsCleaner Discord reporting:
DiscordReporterclass--dry-run) for testing without sending webhooksRemoved obsolete files:
instaOneTimeCompare.py(one-off comparison tool, superseded by snapshot diffing)Updated credentials & documentation:
example_credentials.py(removeddriver_path,service_account_path)session_fileanddelay_rangeoptionsNotable Implementation Details
https://claude.ai/code/session_01NW36HHEBk3eCps3Lrb2qsr