# pggamer2/rickroll-detector architecture

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

- Interactive diagram: https://gitdiagram.com/pggamer2/rickroll-detector
- Repository: https://github.com/pggamer2/rickroll-detector

## Overview

Rickroll Detector is a browser-based YouTube link checker. Its main workflow extracts a video ID, checks known video IDs and local detection history, then—if still unflagged—queries YouTube and checks channel IDs, title, and description before displaying a result. Detected links can be added to cookie-backed history, which can be viewed and removed. The HTML entry point and blacklist data are present in the tree but were not excerpted, so UI wiring beyond the shown DOM interactions is not inferred.

Main entry points: [`main.js`](https://github.com/pggamer2/rickroll-detector/blob/main/main.js) (Link checker), [`rickrollHistory.js`](https://github.com/pggamer2/rickroll-detector/blob/main/rickrollHistory.js) (History controls), [`rickrolls.json`](https://github.com/pggamer2/rickroll-detector/blob/main/rickrolls.json) (Rickroll blacklist)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_detection["Detection"]
  node_checker["Link checker<br/>[main.js]"]
  node_blacklist["Rickroll blacklist<br/>[rickrolls.json]"]
  node_results["Result display<br/>[main.js]"]
end

subgraph group_history["History"]
  node_history_logic["History controls<br/>[rickrollHistory.js]"]
  node_cookies[("Browser cookies")]
end

node_user(("Link submitter"))
node_youtube{{"YouTube API"}}

node_user -.->|"submits link"| node_checker
node_checker -->|"loads list"| node_blacklist
node_checker -->|"requests video"| node_youtube
node_checker -->|"checks history"| node_history_logic
node_checker -->|"displays result"| node_results
node_results -->|"adds detection"| node_history_logic
node_history_logic -->|"reads and writes"| node_cookies

click node_checker "https://github.com/pggamer2/rickroll-detector/blob/main/main.js"
click node_blacklist "https://github.com/pggamer2/rickroll-detector/blob/main/rickrolls.json"
click node_results "https://github.com/pggamer2/rickroll-detector/blob/main/main.js"
click node_history_logic "https://github.com/pggamer2/rickroll-detector/blob/main/rickrollHistory.js"

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_checker,node_blacklist,node_results toneBlue
class node_history_logic,node_cookies toneAmber
class node_user toneIndigo
class node_youtube toneMint
```

## Components

### Detection

- [Link checker](https://github.com/pggamer2/rickroll-detector/blob/main/main.js): `main.js`
- [Rickroll blacklist](https://github.com/pggamer2/rickroll-detector/blob/main/rickrolls.json): `rickrolls.json`
- [Result display](https://github.com/pggamer2/rickroll-detector/blob/main/main.js): `main.js`

### History

- [History controls](https://github.com/pggamer2/rickroll-detector/blob/main/rickrollHistory.js): `rickrollHistory.js`
- **Browser cookies**

### Other components

- **Link submitter**
- **YouTube API**

## Connections

- Link submitter → Link checker: submits link
- Link checker → Rickroll blacklist: loads list (evidence: `main.js`)
- Link checker → YouTube API: requests video (evidence: `main.js`)
- Link checker → History controls: checks history (evidence: `main.js`)
- Link checker → Result display: displays result (evidence: `main.js`)
- Result display → History controls: adds detection (evidence: `main.js`)
- History controls → Browser cookies: reads and writes (evidence: `rickrollHistory.js`)
