From 878e98228b4ce1b73fc114da8955b7b9a596a773 Mon Sep 17 00:00:00 2001 From: nnn-revo2012 Date: Thu, 19 Jan 2023 03:35:51 +0900 Subject: [PATCH] =?UTF-8?q?Twitch=E5=A4=89=E6=8F=9B=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20-=20TwitchDownloader=201.50.8=E4=BB=A5?= =?UTF-8?q?=E9=99=8D=E3=81=AEJSON=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=AB=E5=AF=BE=E5=BF=9C=20-=20Chat=20Down?= =?UTF-8?q?loader=200.2.3=E3=81=AEjson/jsonl=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E5=A4=89=E6=8F=9B=E4=B8=AD=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=AB=E3=81=AA=E3=82=8B=E3=81=AE=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comeconv/ConvTwitch.cs | 14 +++++++++++++- comeconv/Prop/Version.cs | 4 ++-- comeconv/Util/Utils.cs | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/comeconv/ConvTwitch.cs b/comeconv/ConvTwitch.cs index 8f6488f..fcc0760 100644 --- a/comeconv/ConvTwitch.cs +++ b/comeconv/ConvTwitch.cs @@ -135,6 +135,7 @@ private string ConvChatData(IDictionary data, Props props) } } + private static Regex _RegLocations = new Regex("^(\\d+)\\-(\\d+)", RegexOptions.Compiled); public bool TwitchConvertChatDownloader(string sfile, string dfile) { var enc = new System.Text.UTF8Encoding(false); @@ -207,7 +208,18 @@ public bool TwitchConvertChatDownloader(string sfile, string dfile) { foreach (var emt in jo["emotes"]) { - message = message.Replace(emt["name"].ToString(), ""); + string name = emt["name"].ToString(); + if (string.IsNullOrEmpty(name)) + { + var msg = jo["message"].ToString(); + var loc = emt["locations"].ToString(); + int start = Int32.Parse(_RegLocations.Match(loc).Groups[1].ToString()); + int end = Int32.Parse(_RegLocations.Match(loc).Groups[2].ToString()); + System.Text.Encoding hEncoding = System.Text.Encoding.GetEncoding("UTF-8"); + byte[] btBytes = hEncoding.GetBytes(msg); + name = hEncoding.GetString(btBytes, start, end-start+1); + } + message = message.Replace(name, ""); } } } diff --git a/comeconv/Prop/Version.cs b/comeconv/Prop/Version.cs index 2e0a582..9403f78 100644 --- a/comeconv/Prop/Version.cs +++ b/comeconv/Prop/Version.cs @@ -4,8 +4,8 @@ namespace comeconv.Prop { public class Ver { - public static readonly string Version = "0.0.1.19"; - public static readonly string VerDate = "2022/12/10"; + public static readonly string Version = "0.0.1.20"; + public static readonly string VerDate = "2023/01/19"; public static string GetFullVersion() { diff --git a/comeconv/Util/Utils.cs b/comeconv/Util/Utils.cs index 3f0e657..b1413c1 100644 --- a/comeconv/Util/Utils.cs +++ b/comeconv/Util/Utils.cs @@ -140,7 +140,7 @@ public static int IsTwitchFileType(string filename) result = 0; else if (RgxCDJson.IsMatch(str)) result = 1; - else if (str.StartsWith("{\"streamer\":{\"name\":")) + else if (str.StartsWith("{\"streamer\":{\"name\":")|| str.StartsWith("{\"FileInfo\":{\"Version\":")) result = 5; else result = 10;