# nauvalunesa/apiytdlp architecture

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

- Interactive diagram: https://gitdiagram.com/nauvalunesa/apiytdlp
- Repository: https://github.com/nauvalunesa/apiytdlp

## Overview

YTDownloader is a FastAPI service with an HTML browser interface for searching and downloading media from YouTube, Spotify, and Douyin. Its principal workflow is a user request to an API capability, followed by metadata lookup or media retrieval and a response/download link. The main.py excerpt shows Douyin scraping, YouTube download work, and Spotify API access; README-documented capabilities are included, but their unsampled handlers and wiring cannot be verified here.

Main entry points: [`main.py`](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py) (FastAPI API), [`index.html`](https://github.com/nauvalunesa/apiytdlp/blob/main/index.html) (HTML interface), [`bannedip.json`](https://github.com/nauvalunesa/apiytdlp/blob/main/bannedip.json) (Banned IP list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_youtube["YouTube media"]
  node_youtube_search["Video search<br/>[main.py]"]
  node_youtube_info["Video information<br/>[main.py]"]
  node_youtube_video["Video download<br/>[main.py]"]
  node_youtube_audio["Audio download<br/>[main.py]"]
  node_youtube_subtitle["Subtitle download<br/>[main.py]"]
  node_youtube_playlist["Playlist download<br/>[main.py]"]
  node_youtube["YouTube"]
end

subgraph group_spotify["Spotify media"]
  node_spotify_search["Track search<br/>[main.py]"]
  node_spotify_info["Track information<br/>[main.py]"]
  node_spotify_audio["Audio download<br/>[main.py]"]
  node_spotify_playlist["Playlist download<br/>[main.py]"]
  node_spotify["Spotify API"]
end

subgraph group_douyin["Douyin media"]
  node_douyin_download["Media download<br/>[main.py]"]
  node_savetik["Savetik service"]
end

subgraph group_service["Web service"]
  node_api["FastAPI API<br/>[main.py]"]
  node_stats["Server statistics<br/>[main.py]"]
  node_rate_limit["IP rate limiting<br/>[main.py]"]
  node_banned_ips["Banned IP list<br/>[bannedip.json]"]
end

node_user(("User"))
node_browser["HTML interface<br/>[index.html]"]

node_user -->|"uses"| node_browser
node_browser -.->|"requests API"| node_api
node_user -->|"searches videos"| node_youtube_search
node_user -->|"requests details"| node_youtube_info
node_user -->|"requests video"| node_youtube_video
node_user -->|"requests audio"| node_youtube_audio
node_user -->|"requests subtitles"| node_youtube_subtitle
node_user -->|"requests playlist"| node_youtube_playlist
node_youtube_search -.->|"searches"| node_youtube
node_youtube_info -.->|"looks up"| node_youtube
node_youtube_video -.->|"downloads"| node_youtube
node_youtube_audio -.->|"downloads"| node_youtube
node_youtube_subtitle -.->|"downloads"| node_youtube
node_youtube_playlist -.->|"downloads"| node_youtube
node_user -->|"searches tracks"| node_spotify_search
node_user -->|"requests details"| node_spotify_info
node_user -->|"requests audio"| node_spotify_audio
node_user -->|"requests playlist"| node_spotify_playlist
node_spotify_search -.->|"searches"| node_spotify
node_spotify_info -->|"looks up"| node_spotify
node_spotify_audio -.->|"retrieves track data"| node_spotify
node_spotify_playlist -->|"retrieves tracks"| node_spotify
node_user -->|"requests media"| node_douyin_download
node_douyin_download -->|"posts URL"| node_savetik
node_user -->|"requests statistics"| node_stats
node_api -->|"checks requests"| node_rate_limit
node_rate_limit -->|"loads addresses"| node_banned_ips
node_api -.->|"routes requests"| node_youtube_audio
node_api -.->|"routes requests"| node_douyin_download

click node_browser "https://github.com/nauvalunesa/apiytdlp/blob/main/index.html"
click node_api "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_youtube_search "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_youtube_info "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_youtube_video "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_youtube_audio "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_youtube_subtitle "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_youtube_playlist "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_spotify_search "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_spotify_info "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_spotify_audio "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_spotify_playlist "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_douyin_download "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_stats "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_rate_limit "https://github.com/nauvalunesa/apiytdlp/blob/main/main.py"
click node_banned_ips "https://github.com/nauvalunesa/apiytdlp/blob/main/bannedip.json"

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_youtube_search,node_youtube_info,node_youtube_video,node_youtube_audio,node_youtube_subtitle,node_youtube_playlist,node_youtube,node_user toneBlue
class node_spotify_search,node_spotify_info,node_spotify_audio,node_spotify_playlist,node_spotify toneAmber
class node_douyin_download,node_savetik toneMint
class node_api,node_stats,node_rate_limit,node_banned_ips toneRose
class node_browser toneTeal
```

## Components

### YouTube media

- [Video search](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Video information](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Video download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Audio download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Subtitle download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Playlist download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- **YouTube**

### Spotify media

- [Track search](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Track information](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Audio download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Playlist download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- **Spotify API**

### Douyin media

- [Media download](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- **Savetik service**

### Web service

- [FastAPI API](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Server statistics](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [IP rate limiting](https://github.com/nauvalunesa/apiytdlp/blob/main/main.py): `main.py`
- [Banned IP list](https://github.com/nauvalunesa/apiytdlp/blob/main/bannedip.json): `bannedip.json`

### Other components

- **User**
- [HTML interface](https://github.com/nauvalunesa/apiytdlp/blob/main/index.html): `index.html`

## Connections

- User → HTML interface: uses (evidence: `README.md`)
- HTML interface → FastAPI API: requests API
- User → Video search: searches videos (evidence: `README.md`)
- User → Video information: requests details (evidence: `README.md`)
- User → Video download: requests video (evidence: `README.md`)
- User → Audio download: requests audio (evidence: `README.md`)
- User → Subtitle download: requests subtitles (evidence: `README.md`)
- User → Playlist download: requests playlist (evidence: `README.md`)
- Video search → YouTube: searches
- Video information → YouTube: looks up
- Video download → YouTube: downloads
- Audio download → YouTube: downloads
- Subtitle download → YouTube: downloads
- Playlist download → YouTube: downloads
- User → Track search: searches tracks (evidence: `README.md`)
- User → Track information: requests details (evidence: `README.md`)
- User → Audio download: requests audio (evidence: `README.md`)
- User → Playlist download: requests playlist (evidence: `README.md`)
- Track search → Spotify API: searches
- Track information → Spotify API: looks up (evidence: `main.py`)
- Audio download → Spotify API: retrieves track data
- Playlist download → Spotify API: retrieves tracks (evidence: `main.py`)
- User → Media download: requests media (evidence: `README.md`)
- Media download → Savetik service: posts URL (evidence: `main.py`)
- User → Server statistics: requests statistics (evidence: `README.md`)
- FastAPI API → IP rate limiting: checks requests (evidence: `main.py`)
- IP rate limiting → Banned IP list: loads addresses (evidence: `main.py`)
- FastAPI API → Audio download: routes requests (evidence: `main.py`)
- FastAPI API → Media download: routes requests (evidence: `main.py`)
