- Migrated to twitch helix api for stream notifications

- Added 2 new fields to creds.yml -> TwitchClientId and TwitchClientSecret
- Users now have to provide them in order to use twitch stream notifications as Twitch is shutting down old api on 18th of February 2022
- Possibly fixed some issues with streams randomly getting cleared
- Added an incomplete trovo stream notification provider
This commit is contained in:
Kwoth
2022-02-15 17:03:31 +01:00
parent 7ed1b13e85
commit e6e802b563
15 changed files with 340 additions and 330 deletions

View File

@@ -31,7 +31,7 @@ public class TrovoProvider : Provider
return GetStreamDataAsync(match.Groups["channel"].Value);
}
public override async Task<StreamData?> GetStreamDataAsync(string id)
public override async Task<StreamData?> GetStreamDataAsync(string login)
{
using var http = _httpClientFactory.CreateClient();
@@ -53,7 +53,7 @@ public class TrovoProvider : Provider
$"https://open-api.trovo.live/openplatform/channels/id",
new TrovoRequestData()
{
ChannelId = id
ChannelId = login
});
res.EnsureSuccessStatusCode();
@@ -62,8 +62,8 @@ public class TrovoProvider : Provider
if (data is null)
{
Log.Warning("An empty response received while retrieving stream data for trovo.live/{TrovoId}", id);
_failingStreams.TryAdd(id, DateTime.UtcNow);
Log.Warning("An empty response received while retrieving stream data for trovo.live/{TrovoId}", login);
_failingStreams.TryAdd(login, DateTime.UtcNow);
return null;
}
@@ -83,8 +83,8 @@ public class TrovoProvider : Provider
}
catch (Exception ex)
{
Log.Warning(ex, "Error retrieving stream data for trovo.live/{TrovoId}", id);
_failingStreams.TryAdd(id, DateTime.UtcNow);
Log.Warning(ex, "Error retrieving stream data for trovo.live/{TrovoId}", login);
_failingStreams.TryAdd(login, DateTime.UtcNow);
return null;
}
}