Ich habe einen Angular -Client, um Video von einer Website durch einen IIS -Server (C#) herunterzuladen. Der Download -Prozess funktioniert jetzt (ich verwende YouTubedlSharp DLL, um es zu tun). Dinge, von denen ich nicht weiß, wie es geht, ist, Daten (z.
public MainWindow()
{
this.YoutubeDL = new YoutubeDL() { YoutubeDLPath = "yt-dlp.exe" };
this.DataContext = this;
InitializeComponent();
progress = new Progress((p) => showProgress(p));
output = new Progress((s) => txtOutput.AppendText(s + Environment.NewLine));
}
< /code>
Download -Prozess: < /p>
if (AudioOnly)
{
result = await YoutubeDL.RunAudioDownload(
url, AudioConversionFormat.Mp3, progress: progress,
output: output, overrideOptions: custom
);
}
else
{
result = await YoutubeDL.RunVideoDownload(
url,
progress: progress,
output: output,
overrideOptions: custom
);
}
if (result.Success)
{
MessageBox.Show($"Successfully downloaded \"{url}\" to:\n\"{result.Data}\".", "YoutubeDLSharp");
}
private void showProgress(DownloadProgress p)
{
txtState.Text = p.State.ToString();
progDownload.Value = p.Progress;
txtProgress.Text = $"speed: {p.DownloadSpeed} | left: {p.ETA}";
}
< /code>
Die "Prozess" und "Ausgabe" sind die Informationen, die ich an die Angular Client -App zurücksenden muss.
Hier ist mein Arbeitscode: < /p>
[HttpGet("download")]
public async Task Download()
{
YoutubeDL youtubeDL = new()
{
YoutubeDLPath = @"yt-dlp.exe",
FFmpegPath = @"ffmpeg.exe",
OutputFolder = @"d:\medias\videos\animals",
};
var url = @"https://www.xxxxxxxxx.com/watch?v=xxxxxxxxxx";
var result = await youtubeDL.RunVideoDownload(url);
return Ok(result);
}
`
< /code>
Kann dies geschehen?
Thanks.
Senden des Aktualisierungsstatus von IIS Server (C#) an Angular Client zurück ⇐ C#
-
- Similar Topics
- Replies
- Views
- Last post