# daxeel/instagram-algorithm architecture

> Architecture diagram of the GitHub repository daxeel/instagram-algorithm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daxeel/instagram-algorithm
- Repository: https://github.com/daxeel/instagram-algorithm

## Overview

This repository is a small Instagram account-discovery tool. Its main workflow accepts a username, extracts and ranks hashtags from recent posts, scans posts under popular tags, and returns usernames associated with those interests. The CLI prints results; api.py provides JSON data including profile pictures. The source shows these stages in two scripts, but does not establish a shared runtime between them.

Main entry points: [`insta-cli.py`](https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py) (Tag scan and lookup), [`api.py`](https://github.com/daxeel/instagram-algorithm/blob/master/api.py) (Tag scan and lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_cli_entry["CLI entry<br/>[insta-cli.py]"]
  node_cli_setup["Profile setup<br/>[insta-cli.py]"]
  node_cli_interests["Hashtag extraction<br/>[insta-cli.py]"]
  node_cli_scan["Tag scan and lookup<br/>[insta-cli.py]"]
  node_cli_results["Print usernames<br/>[insta-cli.py]"]
end

subgraph group_json["JSON workflow"]
  node_api_setup["JSON setup<br/>[api.py]"]
  node_api_interests["Hashtag extraction<br/>[api.py]"]
  node_api_scan["Tag scan and lookup<br/>[api.py]"]
  node_api_results["JSON results<br/>[api.py]"]
end

subgraph group_services["Instagram services"]
  node_instagram_web["Instagram pages"]
  node_instagram_api["Instagram API"]
end

node_user(("User"))

node_user -->|"supplies username"| node_cli_entry
node_cli_entry -->|"calls setup"| node_cli_setup
node_cli_setup -->|"fetches profile"| node_instagram_web
node_cli_setup -->|"calls get_users"| node_cli_scan
node_cli_scan -->|"calls get_hashtags"| node_cli_interests
node_cli_interests -->|"returns ranked tags"| node_cli_scan
node_cli_scan -->|"fetches tag pages"| node_instagram_web
node_cli_scan -->|"looks up users"| node_instagram_api
node_cli_scan -->|"prints usernames"| node_cli_results
node_api_setup -->|"fetches profile"| node_instagram_web
node_api_setup -->|"calls get_users"| node_api_scan
node_api_scan -->|"calls get_hashtags"| node_api_interests
node_api_interests -->|"returns ranked tags"| node_api_scan
node_api_scan -->|"fetches tag pages"| node_instagram_web
node_api_scan -->|"looks up users"| node_instagram_api
node_api_scan -->|"returns JSON"| node_api_results

click node_cli_entry "https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py"
click node_cli_setup "https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py"
click node_cli_interests "https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py"
click node_cli_scan "https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py"
click node_cli_results "https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py"
click node_api_setup "https://github.com/daxeel/instagram-algorithm/blob/master/api.py"
click node_api_interests "https://github.com/daxeel/instagram-algorithm/blob/master/api.py"
click node_api_scan "https://github.com/daxeel/instagram-algorithm/blob/master/api.py"
click node_api_results "https://github.com/daxeel/instagram-algorithm/blob/master/api.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli_entry,node_cli_setup,node_cli_interests,node_cli_scan,node_cli_results,node_user toneBlue
class node_api_setup,node_api_interests,node_api_scan,node_api_results toneAmber
class node_instagram_web,node_instagram_api toneMint
```

## Components

### CLI workflow

- [CLI entry](https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py): `insta-cli.py`
- [Profile setup](https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py): `insta-cli.py`
- [Hashtag extraction](https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py): `insta-cli.py`
- [Tag scan and lookup](https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py): `insta-cli.py`
- [Print usernames](https://github.com/daxeel/instagram-algorithm/blob/master/insta-cli.py): `insta-cli.py`

### JSON workflow

- [JSON setup](https://github.com/daxeel/instagram-algorithm/blob/master/api.py): `api.py`
- [Hashtag extraction](https://github.com/daxeel/instagram-algorithm/blob/master/api.py): `api.py`
- [Tag scan and lookup](https://github.com/daxeel/instagram-algorithm/blob/master/api.py): `api.py`
- [JSON results](https://github.com/daxeel/instagram-algorithm/blob/master/api.py): `api.py`

### Instagram services

- **Instagram pages**
- **Instagram API**

### Other components

- **User**

## Connections

- User → CLI entry: supplies username
- CLI entry → Profile setup: calls setup
- Profile setup → Instagram pages: fetches profile
- Profile setup → Tag scan and lookup: calls get_users
- Tag scan and lookup → Hashtag extraction: calls get_hashtags
- Hashtag extraction → Tag scan and lookup: returns ranked tags
- Tag scan and lookup → Instagram pages: fetches tag pages
- Tag scan and lookup → Instagram API: looks up users
- Tag scan and lookup → Print usernames: prints usernames
- JSON setup → Instagram pages: fetches profile
- JSON setup → Tag scan and lookup: calls get_users
- Tag scan and lookup → Hashtag extraction: calls get_hashtags
- Hashtag extraction → Tag scan and lookup: returns ranked tags
- Tag scan and lookup → Instagram pages: fetches tag pages
- Tag scan and lookup → Instagram API: looks up users
- Tag scan and lookup → JSON results: returns JSON
