diff --git a/src/Translumo.Infrastructure/Constants/RegexStorage.cs b/src/Translumo.Infrastructure/Constants/RegexStorage.cs index acc2eeb3..6bdcbe0b 100644 --- a/src/Translumo.Infrastructure/Constants/RegexStorage.cs +++ b/src/Translumo.Infrastructure/Constants/RegexStorage.cs @@ -1,4 +1,4 @@ -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; namespace Translumo.Infrastructure.Constants { @@ -28,7 +28,7 @@ static RegexStorage() EndDotRegex = new Regex(@"\.{3,}$", RegexOptions.Compiled); GoogleTranslateResultRegex = new Regex("(?<=())[\\s\\S]*?(?=(<\\/div>))", RegexOptions.Compiled | RegexOptions.IgnoreCase); GuidGenerationRegex = new Regex("[xy]", RegexOptions.Compiled); - YandexSidRegex = new Regex(@"(?<=(SID\:\s*')).*(?=('))", RegexOptions.Compiled); + YandexSidRegex = new Regex(@"(?<=(sid\:\s*')).*(?=('))", RegexOptions.Compiled | RegexOptions.IgnoreCase); DeeplSentenceRegex = new Regex(@"(\S.+?([.!?♪。]|$))([\r\n]+|(?=\s+|$))", RegexOptions.Compiled | RegexOptions.Multiline); } } diff --git a/src/Translumo.Translation/Yandex/YandexReaderProxy.cs b/src/Translumo.Translation/Yandex/YandexReaderProxy.cs index edb4063e..aff6661d 100644 --- a/src/Translumo.Translation/Yandex/YandexReaderProxy.cs +++ b/src/Translumo.Translation/Yandex/YandexReaderProxy.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Net.Http; using System.Text.Json; @@ -61,16 +61,10 @@ public string ExtractSid(string body) return string.Empty; } - const char SID_SEPARATOR = '.'; - var match = RegexStorage.YandexSidRegex.Match(body); if (match.Success) { - var splittedReversed = match.Value - .Split(SID_SEPARATOR) - .Select(str => new string(str.Reverse().ToArray())); - - return string.Join(SID_SEPARATOR, splittedReversed); + return match.Value; } return string.Empty;