audiobookshelf/server/utils
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
..
generators remove token from hls url 2025-08-19 15:29:49 +02:00
migrations Migrate tools and collapse series. fix continue shelves. remove old objects 2025-01-05 14:09:03 -06:00
parsers Update opf parser to support refines meta elements 2025-03-13 17:49:05 -05:00
queries Fix server crash filtering by decade with collapsed series 2025-12-24 17:07:05 -06:00
areEquivalent.js Add feed migration and cleanup 2023-07-05 18:18:37 -05:00
comicBookExtractors.js Fix catch exception on failed to parse comic metadata #3804 2025-01-08 16:53:56 -06:00
constants.js constants.js in server/utils and client/plugins updated. 2025-04-20 18:34:33 +05:30
ffmpegHelpers.js Fix issue with episode downloads without streams, fallback to regular dl on ffprobe fail 2025-09-10 17:10:00 -05:00
fileUtils.js Use PowerShell to get windows drive paths. 2025-07-25 12:34:29 -05:00
globals.js fix(AIFF is supported, but AIF isn't) 2025-04-20 07:56:44 +05:30
htmlEntities.js Ability to decode HTML Entities when all tags are stripped. Fixes #929 2022-08-30 19:20:35 -04:00
htmlSanitizer.js Update custom metadata provider results to sanitize html descriptions #3880 2025-01-26 10:51:18 -06:00
index.js SearchController: simplify query param validation logic 2025-10-21 09:38:35 +03:00
libraryHelpers.js Migrate tools and collapse series. fix continue shelves. remove old objects 2025-01-05 14:09:03 -06:00
longTimeout.js Fix:Shares not working with timeouts longer than 23 days #3164 2024-07-27 17:40:51 -05:00
notifications.js Fix notification js docs and update description/defaults 2025-06-09 16:21:05 -05:00
podcastUtils.js Fix podcast failed to parse rss feed when feed is not using CData in content:encoded #4757 2025-10-19 17:25:18 -05:00
prober.js Fix merging embedded chapters for multi-track audiobooks giving incorrect chapter ids #3361 2025-01-12 09:56:48 -06:00
profiler.js Add a profile utility function 2025-02-08 10:41:56 +02:00
rateLimiterFactory.js Support disabled rate limiter by setting max to 0, add logs when rate limit is changed from default 2025-07-12 10:51:07 -05:00
scandir.js Update watcher to re-scan library items when non-media files are added/updated #4245 2025-05-01 17:17:40 -05:00
stringifySequelizeQuery.js fix stringifySequelizeQuery and add tests 2025-02-15 23:57:27 +02:00
youtubeUtils.js Add YouTube download feature with yt-dlp integration 2025-12-31 01:32:37 +00:00
zipHelpers.js Fix multiple download for podcasts & cleanup 2025-03-18 17:28:49 -05:00