Skip to content

Commit

Permalink
fixed 7TV and ffz
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel2193 committed Jan 16, 2024
1 parent 08de063 commit ebdb762
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using System.IO;
using System.Net;
using System.Net.Http;
Expand All @@ -12,7 +13,7 @@ namespace EmoteDownloader
{
class Program
{
private static string version = "1.1.1";
private static string version = "1.1.2";
class Emote
{
public string url = "";
Expand Down Expand Up @@ -254,11 +255,11 @@ public static async Task<int> Main(params string[] args)
}
else if (platform.ToLower() == "ffz")
{
url = $"https://api.betterttv.net/3/cached/frankerfacez/users/twitch/{channel_id}";
url = $"https://api.frankerfacez.com/v1/room/id/{channel_id}";
}
else if (platform.ToLower() == "7tv")
{
url = $"https://api.7tv.app/v2/users/{channel_id}/emotes";
url = $"https://7tv.io/v3/users/twitch/{channel_id}";
}
string emotesJson = GetApiJson(url, token, client_id, platform.ToLower() == "twitch").GetAwaiter().GetResult();
if (emotesJson == null)
Expand All @@ -270,16 +271,29 @@ public static async Task<int> Main(params string[] args)
{
console.Out.Write($"Got emotesJson for channel ID: {channel_id}\n");
}
JObject emotesObj;
if (platform.ToLower() == "ffz" || platform.ToLower() == "7tv")
JObject emotesObj = JObject.Parse(emotesJson);
if (platform.ToLower() == "ffz")
{
emotesObj = JObject.Parse("{\"data\": " + emotesJson + "}");
}
else
foreach(var emote in emotesObj["sets"].First.First["emoticons"])
{
emotes.Add(emote["name"].ToString(), new Emote($"https://cdn.frankerfacez.com/emote/{emote["id"].ToString()}/4"));
}
}
else if(platform.ToLower() == "7tv")
{
emotesObj = JObject.Parse(emotesJson);
if (emotesObj["error"] != null)
{
continue;
}
if (emotesObj["emote_set"]["emotes"] != null)
{
foreach(var emote in emotesObj["emote_set"]["emotes"])
{
emotes.Add(emote["name"].ToString(), new Emote($"https://cdn.7tv.app/emote/{emote["id"]}/4x.webp", "webp"));
}
}
}
if (platform.ToLower() == "bttv")
else if (platform.ToLower() == "bttv")
{
if (emotesObj["channelEmotes"] != null)
{
Expand Down

0 comments on commit ebdb762

Please sign in to comment.