mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
dev: Added initial version of the grpc api. Added relevant dummy settings to creds (they have no effect rn)
dev: Yt searches now INTERNALLY return multiple results but there is no way right now to paginate plain text results dev: moved some stuff around
This commit is contained in:
@@ -18,7 +18,7 @@ public sealed class InvidiousYtSearchService : IYoutubeSearchService, INService
|
||||
_rng = new();
|
||||
}
|
||||
|
||||
public async Task<VideoInfo?> SearchAsync(string query)
|
||||
public async Task<VideoInfo[]?> SearchAsync(string query)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(query);
|
||||
|
||||
@@ -35,6 +35,7 @@ public sealed class InvidiousYtSearchService : IYoutubeSearchService, INService
|
||||
var url = $"{instance}/api/v1/search"
|
||||
+ $"?q={query}"
|
||||
+ $"&type=video";
|
||||
|
||||
using var http = _http.CreateClient();
|
||||
var res = await http.GetFromJsonAsync<List<InvidiousSearchResponse>>(
|
||||
url);
|
||||
@@ -42,6 +43,6 @@ public sealed class InvidiousYtSearchService : IYoutubeSearchService, INService
|
||||
if (res is null or { Count: 0 })
|
||||
return null;
|
||||
|
||||
return new VideoInfo(res[0].VideoId);
|
||||
return res.Map(r => new VideoInfo(r.VideoId));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user