Промпт для создания собственного загрузчикавидео, с помощью которого вы сможете скачивать ролики изсоцсетей и c других сайтов.
Create a native macOS SwiftUI app Clip, wrapping yt-dlp. Minimal, polished, Tahoe Liquid Glass design. macOS 14+, Swift 5.9.
## Stack
SwiftUI App lifecycle, xcodegen, bundled yt-dlp/ffmpeg/ffprobe (universal binaries in Resources/bin/), hardened runtime with entitlements for unsigned memory + disabled library validation + network access.
## Architecture
```
Clip/
ClipApp.swift –
https://t.me/main, NSApplicationDelegateAdaptor, menu bar + clipboard
ClipTheme.swift – Tahoe tokens, GlassCard, GlassProgressBar, button styles
ClipConstants.swift – Named constants
Models/ – Platform enum, DownloadItem (
https://t.me/MainActor ObservableObject), DownloadHistory (JSON), VideoMetadata (yt-dlp JSON)
ViewModels/ – MainViewModel (URL input + metadata), DownloadViewModel (queue + compression)
Views/ – ContentView, URLInput, VideoPreview, FormatPicker, ClipRange, DownloadSection, DownloadList, History, SaveLocation, MenuBar, StatusBar, UpdateBanner, Settings
Services/ – YTDLPService (actor), FFmpegService, URLDetector, ClipboardMonitor, RedditResolver, UpdateService
```
## Design — Tahoe Liquid Glass
- Pill-shaped buttons (Capsule), glass cards (controlBackgroundColor + 0.06 stroke + shadow), superellipse corners (.continuous)
- Cards: 16pt radius, small: 10pt, buttons: Capsule
- GlassCard: controlBackgroundColor fill, subtle stroke, shadow (6% black, 4pt blur, 2pt y)
- GlassProgressBar: pill capsule, 5% black track, tinted fill, easeOut animation
- Colors: AccentColor (blue), ClipLavender (purple), ClipRosewood (pink), ClipCoral (red), ClipBronze (orange), ClipSuccess (green)
## Key Features
- **URL Input**: Paste + Analyze buttons, drag-drop support, clipboard monitoring
- **Video Preview**: Thumbnail + title + platform badge + duration
- **Format Picker**: Horizontal pill buttons — Format (MP4/MOV/WebM/MP3), Resolution (4K–360p), Target Size (Original/Custom MB), Clip toggle with scissors symbolEffect(.bounce)
- **Clip Range**: Draggable timecode bar with two blue handles
- **Downloads**: Glass segmented tabs (Downloads/History), progress bars, concurrent queue (max 3)
- **Menu Bar**: NSPopover two-step flow — paste URL → analyze → configure format/resolution/size → download. StatusBarController with progress arc overlay on icon.
- **Window**: TranslucentWindowBackground NSViewRepresentable — tags window as "ClipMainWindow", dark mode 95% alpha (resolve dynamic color via performAsCurrentDrawingAppearance), close interceptor hides instead of destroying
## Critical Patterns
1. Binary path: `Bundle.main.bundlePath + "/Contents/Resources"` (never `Bundle.main.path(forResource:ofType:)`)
2. PATH: prepend bundled dir + homebrew paths
3. Reddit: custom resolver via http://api.reddit.com/ (yt-dlp extractor broken)
4. Instagram: auto-detect browser cookies
5. Cancel: set isCancelled before terminating Process
6. Queue: startNextQueued() after every completion/failure/cancel
7. Window: close hides via WindowCloseInterceptor delegate
8. Thread safety:
https://t.me/MainActor for UI, actor for YTDLPService, NSLock for OutputPathHolder
9. Deploy: rm -rf before cp -R (prevents nested .app)
10. Animations: easeInOut 0.2s on pills, spring on clip range, crossfade tabs, bounce on scissors, scale+opacity on button press
## Platforms
YouTube, X/Twitter, Instagram, TikTok, Reddit + any yt-dlp-supported site as .unknown
## Build
```bash
brew install xcodegen && xcodegen generate
xcodebuild -project Clip.xcodeproj -scheme Clip build
rm -rf /Applications/ http://Clip.app/ && cp -R build/Build/Products/Debug/ http://Clip.app/ /Applications/
xattr -cr /Applications/ http://Clip.app/ && open /Applications/ http://Clip.app/
```
Можно использовать в Cursor,ChatGPT или Claude. На выходе получитcя личный бесплатныйсервис. Дизайн и другие детали вы сможете настроить под себя.
Наслаждаемся.
#полезное #промпты