audiobookshelf/server/controllers
Claude aaf87821a3
Add YouTube download feature with yt-dlp integration
This commit implements a comprehensive YouTube download feature that allows
administrators to download audio from YouTube videos and playlists.

Backend Changes:
- Add yt-dlp-wrap npm dependency for YouTube downloading
- Create YouTubeDownloadManager to handle download queue and execution
- Create YouTubeDownloadController with API endpoints for download/queue/cancel
- Add YouTube utility functions for URL validation and metadata extraction
- Create YouTubeDownload object model for tracking download state
- Add API routes: POST /api/youtube/download, GET /api/youtube/queue, DELETE /api/youtube/download/:id
- Implement playlist support - automatically queue all videos from playlist URLs
- Download audio in MP3 format with best quality
- Organize files in subfolder structure: <Uploader>/<Video Title>/
- Extract metadata and create library items automatically
- Real-time progress updates via Socket.io

Frontend Changes:
- Create YouTubeDownloadModal component for user-friendly download interface
- Add download button to Appbar header (admin-only, visible with current library)
- Update Vuex store with modal state management
- Register modal globally in default layout
- Implement Socket.io listeners for download events (started, progress, completed, failed, queued)
- Show toast notifications for download status updates

Features:
- Admin-only access control
- Support for single videos and playlists
- Audio quality selection (best, 320kbps, 256kbps, 192kbps, 128kbps)
- Library and folder selection
- Download queue management
- Real-time progress tracking
- Automatic thumbnail download as cover image
- Automatic library item creation with metadata
- Error handling and user feedback

Technical Details:
- Uses yt-dlp for reliable YouTube downloading
- Integrates with existing task management system
- Respects library folder permissions
- Follows existing code patterns (similar to podcast downloads)
- Socket.io events for real-time updates
2025-12-31 01:32:37 +00:00
..
ApiKeyController.js Update jwt secret handling 2025-07-08 16:39:50 -05:00
AuthorController.js Fix socket events check user permissions for library items #4199 2025-04-12 17:39:51 -05:00
BackupController.js Update API JS docs 2024-08-11 17:01:25 -05:00
CacheController.js Update API JS docs 2024-08-11 17:01:25 -05:00
CollectionController.js Fix: Users with update permission unable to remove books from collection #3947 2025-02-07 17:09:48 -06:00
CustomMetadataProviderController.js Update API JS docs 2024-08-11 17:01:25 -05:00
EmailController.js Fix local playback sync 2025-01-04 15:35:05 -06:00
FileSystemController.js Fix pathexists filepath back to posix 2025-06-11 16:37:07 -05:00
LibraryController.js Remove custom providers from library filterdata request 2025-10-19 10:54:26 +03:00
LibraryItemController.js Add channels, codec and bitrate to tracks table & breakpoint updates 2025-05-02 15:06:31 -05:00
MeController.js Fix ereader update socket event sending all devices #4529 2025-07-24 17:29:08 -05:00
MiscController.js Update settings update endpoint to validate allowedOrigins is array 2025-10-10 18:00:37 -05:00
NotificationController.js Update NotificationManager to singleton 2024-09-27 17:33:23 -05:00
PlaylistController.js Update controllers to use toOldJSON functions 2025-01-04 15:20:41 -06:00
PodcastController.js Sanitize media item & episode description on update 2025-05-31 17:01:58 -05:00
RSSFeedController.js Remove old Feed/FeedEpisode/FeedMeta objects 2024-12-15 17:54:36 -06:00
SearchController.js Fix Upload Lookup 2025-11-29 11:02:42 +01:00
SeriesController.js Remove old Feed/FeedEpisode/FeedMeta objects 2024-12-15 17:54:36 -06:00
SessionController.js Fix admin user unable to close sessions of other users #4746 2025-10-13 09:50:01 -05:00
ShareController.js Update PlaybackSession to use new library item model 2025-01-03 11:16:03 -06:00
StatsController.js Add admin middleware for StatsController 2025-03-29 17:37:13 -05:00
ToolsController.js Replace advanced options with presets/advanced card 2025-05-02 17:24:46 -05:00
UserController.js Update sessions modal to show username & update sessions endpoints to always return username 2025-07-16 16:56:07 -05:00
YouTubeDownloadController.js Add YouTube download feature with yt-dlp integration 2025-12-31 01:32:37 +00:00