Real YouTube download & MP3 conversion with yt-dlp
- Integrate yt-dlp.exe for real YouTube audio download/conversion - Serve actual MP3 files from wwwroot/downloads via API and static files - Report real-time progress from yt-dlp to frontend - Enhance DownloadController: file serving, metadata, deletion endpoints - Update VideoController to track and return real file info/URLs - Enable static file serving in Program.cs; update API info/logging - Update Blazor frontend to use real download URLs and remove old JS logic - Add README_UPDATED.md with new workflow and troubleshooting - Improve error handling, logging, and file cleanup throughout backend - Update .gitignore for downloads and yt-dlp.exe
This commit is contained in:
@@ -5,6 +5,9 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
|
||||
// Add HttpClient services
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
// Register services
|
||||
builder.Services.AddScoped<IVideoService, VideoService>();
|
||||
|
||||
@@ -32,6 +35,9 @@ if (app.Environment.IsDevelopment())
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
// Enable static files serving (for downloading MP3 files)
|
||||
app.UseStaticFiles();
|
||||
|
||||
// Enable CORS
|
||||
app.UseCors("BlazorPolicy");
|
||||
|
||||
@@ -58,6 +64,7 @@ app.MapGet("/", (IWebHostEnvironment env) => new
|
||||
check_status = "/api/video/status/{jobId}",
|
||||
get_result = "/api/video/result/{jobId}",
|
||||
download = "/api/download/{jobId}",
|
||||
static_files = "/downloads/{fileName}",
|
||||
openapi = "/openapi/v1.json"
|
||||
},
|
||||
testing = new
|
||||
@@ -77,5 +84,6 @@ app.Logger.LogInformation("
|
||||
app.Logger.LogInformation(" • HTTP: http://localhost:5112");
|
||||
app.Logger.LogInformation("?? Health check: /api/health");
|
||||
app.Logger.LogInformation("?? API info: /");
|
||||
app.Logger.LogInformation("?? Static files served from: /downloads/*");
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user