# dinhdung6/social-crawler architecture

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

- Interactive diagram: https://gitdiagram.com/dinhdung6/social-crawler
- Repository: https://github.com/dinhdung6/social-crawler

## Overview

This is a browser-based social crawler and reporting tool. A user logs in through the local Chrome profile, runs searches and post/comment collection across platform adapters, then generates topic workbooks and Markdown summaries from stored data, including Google Trends. The graph preserves the documented platform and optional-comment capabilities; some wiring is supported by the SOURCE INDEX rather than sampled call sites, and unsampled implementation details are not inferred.

Main entry points: [`run.py`](https://github.com/dinhdung6/social-crawler/blob/main/run.py) (CLI orchestration), [`common.py`](https://github.com/dinhdung6/social-crawler/blob/main/common.py) (Browser and DB helpers), [`platforms/instagram.py`](https://github.com/dinhdung6/social-crawler/blob/main/platforms/instagram.py) (Instagram adapter), [`platforms/tiktok.py`](https://github.com/dinhdung6/social-crawler/blob/main/platforms/tiktok.py) (TikTok adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Crawler workflow"]
  node_runner["CLI orchestration<br/>[run.py]"]
  node_shared["Browser and DB helpers<br/>[common.py]"]
end

subgraph group_platforms["Platform collection"]
  node_facebook["Facebook adapter<br/>[facebook.py]"]
  node_instagram["Instagram adapter<br/>[instagram.py]"]
  node_linkedin["LinkedIn adapter<br/>[linkedin.py]"]
  node_tiktok["TikTok adapter<br/>[tiktok.py]"]
  node_youtube["YouTube adapter<br/>[youtube.py]"]
  node_commentclients["Optional comment clients<br/>[comment_clients.py]"]
end

subgraph group_data["Storage and reporting"]
  node_database[("SQLite data")]
  node_report["Report generation<br/>[report.py]"]
end

subgraph group_integrations["External integrations"]
  node_chrome["Installed Chrome"]
  node_social["Social platforms"]
  node_trends["Google Trends"]
end

node_user(("User"))

node_user -->|"runs commands"| node_runner
node_runner -->|"uses helpers"| node_shared
node_runner -->|"dispatches collection"| node_facebook
node_runner -->|"dispatches collection"| node_instagram
node_runner -->|"dispatches collection"| node_linkedin
node_runner -->|"dispatches collection"| node_tiktok
node_runner -->|"dispatches collection"| node_youtube
node_runner -->|"writes records"| node_database
node_runner -->|"starts reporting"| node_report
node_facebook -->|"uses helpers"| node_shared
node_instagram -->|"uses helpers"| node_shared
node_linkedin -->|"uses helpers"| node_shared
node_tiktok -->|"uses helpers"| node_shared
node_youtube -->|"uses helpers"| node_shared
node_instagram -->|"supplements comments"| node_commentclients
node_tiktok -->|"queues comments"| node_commentclients
node_facebook -->|"searches and collects"| node_social
node_instagram -->|"searches and collects"| node_social
node_linkedin -->|"searches and collects"| node_social
node_tiktok -->|"searches and collects"| node_social
node_youtube -->|"searches and collects"| node_social
node_commentclients -.->|"fetches comments"| node_social
node_report -->|"reads records"| node_database
node_report -->|"queries trends"| node_trends
node_runner -->|"opens profile"| node_chrome

click node_runner "https://github.com/dinhdung6/social-crawler/blob/main/run.py"
click node_shared "https://github.com/dinhdung6/social-crawler/blob/main/common.py"
click node_facebook "https://github.com/dinhdung6/social-crawler/blob/main/platforms/facebook.py"
click node_instagram "https://github.com/dinhdung6/social-crawler/blob/main/platforms/instagram.py"
click node_linkedin "https://github.com/dinhdung6/social-crawler/blob/main/platforms/linkedin.py"
click node_tiktok "https://github.com/dinhdung6/social-crawler/blob/main/platforms/tiktok.py"
click node_youtube "https://github.com/dinhdung6/social-crawler/blob/main/platforms/youtube.py"
click node_commentclients "https://github.com/dinhdung6/social-crawler/blob/main/comment_clients.py"
click node_report "https://github.com/dinhdung6/social-crawler/blob/main/report.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_runner,node_shared,node_user toneBlue
class node_facebook,node_instagram,node_linkedin,node_tiktok,node_youtube,node_commentclients toneAmber
class node_database,node_report toneMint
class node_chrome,node_social,node_trends toneRose
```

## Components

### Crawler workflow

- [CLI orchestration](https://github.com/dinhdung6/social-crawler/blob/main/run.py): `run.py`
- [Browser and DB helpers](https://github.com/dinhdung6/social-crawler/blob/main/common.py): `common.py`

### Platform collection

- [Facebook adapter](https://github.com/dinhdung6/social-crawler/blob/main/platforms/facebook.py): `platforms/facebook.py`
- [Instagram adapter](https://github.com/dinhdung6/social-crawler/blob/main/platforms/instagram.py): `platforms/instagram.py`
- [LinkedIn adapter](https://github.com/dinhdung6/social-crawler/blob/main/platforms/linkedin.py): `platforms/linkedin.py`
- [TikTok adapter](https://github.com/dinhdung6/social-crawler/blob/main/platforms/tiktok.py): `platforms/tiktok.py`
- [YouTube adapter](https://github.com/dinhdung6/social-crawler/blob/main/platforms/youtube.py): `platforms/youtube.py`
- [Optional comment clients](https://github.com/dinhdung6/social-crawler/blob/main/comment_clients.py): `comment_clients.py`

### Storage and reporting

- **SQLite data**
- [Report generation](https://github.com/dinhdung6/social-crawler/blob/main/report.py): `report.py`

### External integrations

- **Installed Chrome**
- **Social platforms**
- **Google Trends**

### Other components

- **User**

## Connections

- User → CLI orchestration: runs commands (evidence: `README.md`)
- CLI orchestration → Browser and DB helpers: uses helpers (evidence: `run.py`)
- CLI orchestration → Facebook adapter: dispatches collection (evidence: `run.py`)
- CLI orchestration → Instagram adapter: dispatches collection (evidence: `run.py`)
- CLI orchestration → LinkedIn adapter: dispatches collection (evidence: `run.py`)
- CLI orchestration → TikTok adapter: dispatches collection (evidence: `run.py`)
- CLI orchestration → YouTube adapter: dispatches collection (evidence: `run.py`)
- CLI orchestration → SQLite data: writes records (evidence: `run.py`)
- CLI orchestration → Report generation: starts reporting (evidence: `README.md`)
- Facebook adapter → Browser and DB helpers: uses helpers (evidence: `platforms/facebook.py`)
- Instagram adapter → Browser and DB helpers: uses helpers (evidence: `platforms/instagram.py`)
- LinkedIn adapter → Browser and DB helpers: uses helpers (evidence: `platforms/linkedin.py`)
- TikTok adapter → Browser and DB helpers: uses helpers (evidence: `platforms/tiktok.py`)
- YouTube adapter → Browser and DB helpers: uses helpers (evidence: `platforms/youtube.py`)
- Instagram adapter → Optional comment clients: supplements comments (evidence: `platforms/instagram.py`)
- TikTok adapter → Optional comment clients: queues comments (evidence: `platforms/tiktok.py`)
- Facebook adapter → Social platforms: searches and collects (evidence: `platforms/facebook.py`)
- Instagram adapter → Social platforms: searches and collects (evidence: `platforms/instagram.py`)
- LinkedIn adapter → Social platforms: searches and collects (evidence: `platforms/linkedin.py`)
- TikTok adapter → Social platforms: searches and collects (evidence: `platforms/tiktok.py`)
- YouTube adapter → Social platforms: searches and collects (evidence: `platforms/youtube.py`)
- Optional comment clients → Social platforms: fetches comments (evidence: `README.md`)
- Report generation → SQLite data: reads records (evidence: `report.py`)
- Report generation → Google Trends: queries trends (evidence: `report.py`)
- CLI orchestration → Installed Chrome: opens profile (evidence: `README.md`)
