# thanh2004nguyen/facebook-group-scraper architecture

> Architecture diagram of the GitHub repository thanh2004nguyen/facebook-group-scraper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thanh2004nguyen/facebook-group-scraper
- Repository: https://github.com/thanh2004nguyen/facebook-group-scraper

## Overview

This small Playwright tool has a two-step workflow: the user logs in manually and saves browser state, then runs the scraper, which opens a configured Facebook group, loads and expands feed content, deduplicates extracted posts, and writes them to a text file. The sampled source supports these runtime relationships; the README documents configuration and expected output. Browser and Facebook behavior are represented at a high level.

Main entry points: [`main.py`](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py) (Group scraper), [`login_and_save_state.py`](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/login_and_save_state.py) (Login setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_login["Login setup"]
node_facebook["Facebook"]
node_session["Saved session"]
node_scraper["Group scraper<br/>[main.py]"]
node_feed["Feed loading<br/>[main.py]"]
node_expand["Post expansion<br/>[main.py]"]
node_dedupe["Extract and dedupe<br/>[main.py]"]
node_output["Post output"]

node_user -->|"runs login"| node_login
node_login -->|"opens login"| node_facebook
node_user -->|"logs in"| node_facebook
node_login -->|"saves state"| node_session
node_user -->|"runs scraper"| node_scraper
node_scraper -->|"loads state"| node_session
node_scraper -->|"opens group"| node_facebook
node_scraper -->|"scrolls feed"| node_feed
node_scraper -->|"clicks buttons"| node_expand
node_scraper -->|"extracts posts"| node_dedupe
node_scraper -->|"writes posts"| node_output

click node_login "https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/login_and_save_state.py"
click node_scraper "https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py"
click node_feed "https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py"
click node_expand "https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py"
click node_dedupe "https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.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_user toneBlue
class node_login,node_scraper,node_feed,node_expand,node_dedupe toneTeal
class node_facebook,node_session,node_output toneIndigo
```

## Components

### Other components

- **User**
- [Login setup](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/login_and_save_state.py): `login_and_save_state.py`
- **Facebook**
- **Saved session**
- [Group scraper](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py): `main.py`
- [Feed loading](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py): `main.py`
- [Post expansion](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py): `main.py`
- [Extract and dedupe](https://github.com/thanh2004nguyen/facebook-group-scraper/blob/main/main.py): `main.py`
- **Post output**

## Connections

- User → Login setup: runs login (evidence: `README.md`)
- Login setup → Facebook: opens login (evidence: `login_and_save_state.py`)
- User → Facebook: logs in
- Login setup → Saved session: saves state (evidence: `login_and_save_state.py`)
- User → Group scraper: runs scraper (evidence: `README.md`)
- Group scraper → Saved session: loads state (evidence: `main.py`)
- Group scraper → Facebook: opens group (evidence: `main.py`)
- Group scraper → Feed loading: scrolls feed (evidence: `main.py`)
- Group scraper → Post expansion: clicks buttons (evidence: `main.py`)
- Group scraper → Extract and dedupe: extracts posts (evidence: `main.py`)
- Group scraper → Post output: writes posts (evidence: `main.py`)
