mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
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
23 lines
601 B
C#
23 lines
601 B
C#
namespace NadekoBot.Modules.Searches.Youtube;
|
|
|
|
public sealed class YoutubeDataApiSearchService : IYoutubeSearchService, INService
|
|
{
|
|
private readonly IGoogleApiService _gapi;
|
|
|
|
public YoutubeDataApiSearchService(IGoogleApiService gapi)
|
|
{
|
|
_gapi = gapi;
|
|
}
|
|
|
|
public async Task<VideoInfo[]?> SearchAsync(string query)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(query);
|
|
|
|
var results = await _gapi.GetVideoLinksByKeywordAsync(query);
|
|
|
|
if(results.Count == 0)
|
|
return null;
|
|
|
|
return results.Map(r => new VideoInfo(r));
|
|
}
|
|
} |