# huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension architecture

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

- Interactive diagram: https://gitdiagram.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension
- Repository: https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension

## Overview

This Chrome extension’s workflow starts when a user opens it on a YouTube video page. Its popup script reads the active tab URL, extracts the video ID, constructs thumbnail URLs for several resolutions, and displays available previews with download buttons. The script also filters unavailable high-resolution images and invokes Chrome’s downloads API. The tree identifies the popup markup and stylesheet, but their contents and wiring were not sampled, so those relationships are omitted.

Main entry points: [`popup.js`](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js) (Popup controller), [`popup.html`](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.html) (Popup markup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_popup["Extension popup"]
  node_popup_markup["Popup markup<br/>[popup.html]"]
  node_popup_styles["Popup styles<br/>[popup.css]"]
  node_popup_script["Popup controller<br/>[popup.js]"]
end

subgraph group_thumbnail["Thumbnail workflow"]
  node_video_id["Video ID parsing<br/>[popup.js]"]
  node_resolution_urls["Resolution URLs<br/>[popup.js]"]
  node_thumbnail_preview["Preview and filtering<br/>[popup.js]"]
end

subgraph group_platform["Browser and service"]
  node_chrome_tabs["Chrome active tab"]
  node_youtube_images["YouTube thumbnails"]
  node_chrome_downloads["Chrome downloads"]
end

node_user(("Extension user"))

node_user -->|"opens"| node_popup_markup
node_popup_script -->|"queries tab"| node_chrome_tabs
node_popup_script -->|"extracts ID"| node_video_id
node_popup_script -->|"builds URLs"| node_resolution_urls
node_popup_script -->|"creates previews"| node_thumbnail_preview
node_thumbnail_preview -->|"loads images"| node_youtube_images
node_thumbnail_preview -->|"starts download"| node_chrome_downloads

click node_popup_markup "https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.html"
click node_popup_styles "https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/styles/popup.css"
click node_popup_script "https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js"
click node_video_id "https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js"
click node_resolution_urls "https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js"
click node_thumbnail_preview "https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.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_popup_markup,node_popup_styles,node_popup_script,node_user toneBlue
class node_video_id,node_resolution_urls,node_thumbnail_preview toneAmber
class node_chrome_tabs,node_youtube_images,node_chrome_downloads toneMint
```

## Components

### Extension popup

- [Popup markup](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.html): `popup.html`
- [Popup styles](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/styles/popup.css): `styles/popup.css`
- [Popup controller](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js): `popup.js`

### Thumbnail workflow

- [Video ID parsing](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js): `popup.js`
- [Resolution URLs](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js): `popup.js`
- [Preview and filtering](https://github.com/huynhmaianhkiet/youtube-thumbnail-downloader-chrome-extension/blob/main/popup.js): `popup.js`

### Browser and service

- **Chrome active tab**
- **YouTube thumbnails**
- **Chrome downloads**

### Other components

- **Extension user**

## Connections

- Extension user → Popup markup: opens (evidence: `README.md`)
- Popup controller → Chrome active tab: queries tab (evidence: `popup.js`)
- Popup controller → Video ID parsing: extracts ID (evidence: `popup.js`)
- Popup controller → Resolution URLs: builds URLs (evidence: `popup.js`)
- Popup controller → Preview and filtering: creates previews (evidence: `popup.js`)
- Preview and filtering → YouTube thumbnails: loads images (evidence: `popup.js`)
- Preview and filtering → Chrome downloads: starts download (evidence: `popup.js`)
