-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
47 lines (46 loc) · 1.82 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// query specific fields by setting the variables
MediathekClient clientFirstOption = new MediathekClient {
title = "Frage trifft Antwort - Wie sieht es in einer Karsthöhle aus?",
topic = "Planet Schule - Natur & Umwelt",
channel = Channel.SWR,
size = 1
};
// or use the functions to define the query
MediathekClient clientSecondOption = new MediathekClient()
.searchTitleOrTopic("Sturm der Liebe")
.searchChannel(Channel.NDR)
.setMaximumResults(20)
.orderResultsBy("timestamp", SortOrder.desc);
// send query and retrieve response
var response = await clientFirstOption.sendQuery();
var count = response.countResults();
Console.WriteLine("Anzahl Ergebnisse: " + count.ToString());
Console.WriteLine("Aufgetretene Fehler: " + response?.err?.ToString());
if(count==0){return;}
// download stuff
MediathekDownloader downloader = new MediathekDownloader();
MediathekDownloadOptions options = new MediathekDownloadOptions();
options.SetQualityLD();
options.NameFileAfterTopicTitle();
foreach (var res in response.result.results)
{
Console.WriteLine(res.title);
Console.WriteLine(res.topic);
Console.WriteLine(res.channel);
Console.WriteLine(res.timestamp);
Console.WriteLine(res.url_video_hd);
Console.WriteLine(res.duration);
Console.WriteLine();
// sequential download
downloader.Download(res, options);
// async
await downloader.DownloadAsync(res, "Planet Schule Folge X.mp4");
}
}
}