# adriancheong97/nicole_instascraper_project architecture

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

- Interactive diagram: https://gitdiagram.com/adriancheong97/nicole_instascraper_project
- Repository: https://github.com/adriancheong97/nicole_instascraper_project

## Overview

This is a Streamlit Instagram Stories and Reels scraper with an OCR search feature. Users authenticate (including optional 2FA), choose accounts from CSV or manual input, download stories or selected reels, then optionally scan downloaded videos for visible text and search detections. The workflow is implemented in app.py; excerpts confirm selected function calls and OCR stages, but omitted UI and helper code limit evidence for some connections.

Main entry points: [`app.py`](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py) (Streamlit App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Login"]
  node_app["Streamlit App<br/>[app.py]"]
  node_session["Session State<br/>[app.py]"]
end

subgraph group_inputs["Account Selection"]
  node_targets["Account Targets<br/>[app.py]"]
  node_csv["CSV Upload<br/>[app.py]"]
end

subgraph group_downloads["Instagram Downloads"]
  node_stories["Story Downloads<br/>[app.py]"]
  node_reels["Reel Selection<br/>[app.py]"]
  node_reel_download["Reel Downloads<br/>[app.py]"]
  node_media_files[("Downloaded Media<br/>[app.py]")]
end

subgraph group_ocr["Text Analysis"]
  node_frame_sampling["Frame Sampling<br/>[app.py]"]
  node_ocr["OCR Detection<br/>[app.py]"]
  node_ocr_index[("OCR Index<br/>[app.py]")]
  node_text_search["Text Search<br/>[app.py]"]
  node_results["Search Results<br/>[app.py]"]
end

node_user(("User"))
node_instagram{{"Instagram"}}

node_user -->|"uses"| node_app
node_app -->|"updates"| node_session
node_app -->|"collects"| node_targets
node_csv -->|"provides accounts"| node_targets
node_targets -.->|"selects accounts"| node_stories
node_targets -.->|"selects accounts"| node_reel_download
node_stories -.->|"requests stories"| node_instagram
node_reels -->|"fetches posts"| node_instagram
node_reel_download -->|"downloads matches"| node_reels
node_reel_download -->|"downloads media"| node_instagram
node_stories -.->|"writes media"| node_media_files
node_reel_download -->|"writes media"| node_media_files
node_media_files -.->|"supplies videos"| node_frame_sampling
node_frame_sampling -->|"provides frames"| node_ocr
node_ocr -->|"saves detections"| node_ocr_index
node_ocr_index -->|"provides detections"| node_text_search
node_text_search -->|"returns matches"| node_results
node_app -.->|"offers tab"| node_stories
node_app -.->|"offers tab"| node_reels
node_app -.->|"offers tab"| node_ocr

click node_app "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_session "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_targets "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_csv "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_stories "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_reels "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_reel_download "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_media_files "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_frame_sampling "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_ocr "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_ocr_index "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_text_search "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py"
click node_results "https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.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_app,node_session,node_user toneBlue
class node_targets,node_csv toneAmber
class node_stories,node_reels,node_reel_download,node_media_files toneMint
class node_frame_sampling,node_ocr,node_ocr_index,node_text_search,node_results toneRose
class node_instagram toneIndigo
```

## Components

### Login

- [Streamlit App](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [Session State](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`

### Account Selection

- [Account Targets](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [CSV Upload](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`

### Instagram Downloads

- [Story Downloads](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [Reel Selection](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [Reel Downloads](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [Downloaded Media](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`

### Text Analysis

- [Frame Sampling](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [OCR Detection](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [OCR Index](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [Text Search](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`
- [Search Results](https://github.com/adriancheong97/nicole_instascraper_project/blob/main/app.py): `app.py`

### Other components

- **User**
- **Instagram**

## Connections

- User → Streamlit App: uses (evidence: `app.py`)
- Streamlit App → Session State: updates (evidence: `app.py`)
- Streamlit App → Account Targets: collects (evidence: `app.py`)
- CSV Upload → Account Targets: provides accounts (evidence: `app.py`)
- Account Targets → Story Downloads: selects accounts (evidence: `app.py`)
- Account Targets → Reel Downloads: selects accounts (evidence: `app.py`)
- Story Downloads → Instagram: requests stories
- Reel Selection → Instagram: fetches posts (evidence: `app.py`)
- Reel Downloads → Reel Selection: downloads matches (evidence: `app.py`)
- Reel Downloads → Instagram: downloads media (evidence: `app.py`)
- Story Downloads → Downloaded Media: writes media (evidence: `app.py`)
- Reel Downloads → Downloaded Media: writes media (evidence: `app.py`)
- Downloaded Media → Frame Sampling: supplies videos (evidence: `app.py`)
- Frame Sampling → OCR Detection: provides frames (evidence: `app.py`)
- OCR Detection → OCR Index: saves detections (evidence: `app.py`)
- OCR Index → Text Search: provides detections (evidence: `app.py`)
- Text Search → Search Results: returns matches (evidence: `app.py`)
- Streamlit App → Story Downloads: offers tab (evidence: `app.py`)
- Streamlit App → Reel Selection: offers tab (evidence: `app.py`)
- Streamlit App → OCR Detection: offers tab (evidence: `app.py`)
