diff --git a/AnimeON/Controller.cs b/AnimeON/Controller.cs index 6715fa1..ef8ca26 100644 --- a/AnimeON/Controller.cs +++ b/AnimeON/Controller.cs @@ -161,7 +161,7 @@ namespace AnimeON.Controllers } else { - string playUrl = HostStreamProxy(init, accsArgs(streamLink)); + string playUrl = BuildStreamUrl(init, streamLink, headers: null, forceProxy: false); episode_tpl.Append(episodeName, title ?? original_title, seasonStr, episodeStr, playUrl); } } @@ -217,7 +217,7 @@ namespace AnimeON.Controllers } else { - tpl.Append(translationName, HostStreamProxy(init, accsArgs(streamLink))); + tpl.Append(translationName, BuildStreamUrl(init, streamLink, headers: null, forceProxy: false)); } } } @@ -376,9 +376,30 @@ namespace AnimeON.Controllers return UpdateService.Validate(Content(jsonResult, "application/json; charset=utf-8")); } + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } + string BuildStreamUrl(OnlinesSettings init, string streamLink, List headers, bool forceProxy) { - string link = accsArgs(streamLink); + string link = streamLink?.Trim(); + if (string.IsNullOrEmpty(link)) + return link; + + link = StripLampacArgs(link); + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) diff --git a/Bamboo/Controller.cs b/Bamboo/Controller.cs index 19057d1..2d069db 100644 --- a/Bamboo/Controller.cs +++ b/Bamboo/Controller.cs @@ -121,7 +121,10 @@ namespace Bamboo.Controllers string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = StripLampacArgs(streamLink?.Trim()); + if (string.IsNullOrEmpty(link)) + return link; + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) @@ -135,5 +138,21 @@ namespace Bamboo.Controllers return HostStreamProxy(init, link); } + + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } } } diff --git a/CikavaIdeya/Controller.cs b/CikavaIdeya/Controller.cs index e757b9e..25fb9c3 100644 --- a/CikavaIdeya/Controller.cs +++ b/CikavaIdeya/Controller.cs @@ -388,7 +388,10 @@ namespace CikavaIdeya.Controllers string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = StripLampacArgs(streamLink?.Trim()); + if (string.IsNullOrEmpty(link)) + return link; + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) @@ -402,5 +405,21 @@ namespace CikavaIdeya.Controllers return HostStreamProxy(init, link); } + + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } } } diff --git a/Makhno/Controller.cs b/Makhno/Controller.cs index eb453ca..3302487 100644 --- a/Makhno/Controller.cs +++ b/Makhno/Controller.cs @@ -400,9 +400,30 @@ namespace Makhno await invoke.PostWormholeAsync(payload); } + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } + private string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = streamLink?.Trim(); + if (string.IsNullOrEmpty(link)) + return link; + + link = StripLampacArgs(link); + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) diff --git a/Mikai/Controller.cs b/Mikai/Controller.cs index 51cc11c..c8cb05a 100644 --- a/Mikai/Controller.cs +++ b/Mikai/Controller.cs @@ -116,7 +116,7 @@ namespace Mikai.Controllers } else { - string playUrl = HostStreamProxy(init, accsArgs(streamLink)); + string playUrl = BuildStreamUrl(init, streamLink, headers: null, forceProxy: false); episodeTpl.Append(episodeName, displayTitle, s.ToString(), ep.Number.ToString(), playUrl); } } @@ -142,7 +142,7 @@ namespace Mikai.Controllers } else { - string playUrl = HostStreamProxy(init, accsArgs(episode.Url)); + string playUrl = BuildStreamUrl(init, episode.Url, headers: null, forceProxy: false); movieTpl.Append(voice.DisplayName, playUrl); } } @@ -367,9 +367,30 @@ namespace Mikai.Controllers streamLink.Contains("moonanime.art", StringComparison.OrdinalIgnoreCase); } + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } + private string BuildStreamUrl(OnlinesSettings init, string streamLink, List headers, bool forceProxy) { - string link = accsArgs(streamLink); + string link = streamLink?.Trim(); + if (string.IsNullOrEmpty(link)) + return link; + + link = StripLampacArgs(link); + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) diff --git a/StarLight/Controller.cs b/StarLight/Controller.cs index 32bddf4..0dadfb4 100644 --- a/StarLight/Controller.cs +++ b/StarLight/Controller.cs @@ -169,7 +169,10 @@ namespace StarLight.Controllers string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = StripLampacArgs(streamLink?.Trim()); + if (string.IsNullOrEmpty(link)) + return link; + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) @@ -184,6 +187,22 @@ namespace StarLight.Controllers return HostStreamProxy(init, link, proxy: proxyManager.Get()); } + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } + private static string GetSeasonNumber(SeasonInfo season, int fallbackIndex) { if (season?.Title == null) diff --git a/UAKino/Controller.cs b/UAKino/Controller.cs index e4ed739..f10ea6e 100644 --- a/UAKino/Controller.cs +++ b/UAKino/Controller.cs @@ -92,7 +92,7 @@ namespace UAKino.Controllers string callUrl = $"{host}/uakino/play?url={HttpUtility.UrlEncode(ep.Url)}&title={HttpUtility.UrlEncode(title ?? original_title)}"; if (!string.IsNullOrEmpty(ep.Url) && ep.Url.Contains("ashdi.vip", StringComparison.OrdinalIgnoreCase)) { - string playUrl = HostStreamProxy(init, accsArgs(ep.Url)); + string playUrl = BuildStreamUrl(init, ep.Url); episode_tpl.Append( episodeName, title ?? original_title, @@ -165,9 +165,30 @@ namespace UAKino.Controllers return UpdateService.Validate(Content(jsonResult, "application/json; charset=utf-8")); } + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } + string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = streamLink?.Trim(); + if (string.IsNullOrEmpty(link)) + return link; + + link = StripLampacArgs(link); + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) diff --git a/UaTUT/Controller.cs b/UaTUT/Controller.cs index f82044a..29dadc3 100644 --- a/UaTUT/Controller.cs +++ b/UaTUT/Controller.cs @@ -440,9 +440,30 @@ namespace UaTUT return OnError(); } + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } + string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = streamLink?.Trim(); + if (string.IsNullOrEmpty(link)) + return link; + + link = StripLampacArgs(link); + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) diff --git a/Uaflix/Controller.cs b/Uaflix/Controller.cs index 9676d63..be1ed92 100644 --- a/Uaflix/Controller.cs +++ b/Uaflix/Controller.cs @@ -336,7 +336,10 @@ namespace Uaflix.Controllers string BuildStreamUrl(OnlinesSettings init, string streamLink) { - string link = accsArgs(streamLink); + string link = StripLampacArgs(streamLink?.Trim()); + if (string.IsNullOrEmpty(link)) + return link; + if (ApnHelper.IsEnabled(init)) { if (ModInit.ApnHostProvided || ApnHelper.IsAshdiUrl(link)) @@ -350,5 +353,21 @@ namespace Uaflix.Controllers return HostStreamProxy(init, link); } + + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } } } diff --git a/Unimay/Controllers/Controller.cs b/Unimay/Controllers/Controller.cs index 49d34e0..0c692f9 100644 --- a/Unimay/Controllers/Controller.cs +++ b/Unimay/Controllers/Controller.cs @@ -104,7 +104,8 @@ namespace Unimay.Controllers if (string.IsNullOrEmpty(masterUrl)) return OnError("no stream"); - return UpdateService.Validate(Redirect(HostStreamProxy(init, accsArgs(masterUrl), proxy: proxyManager.Get()))); + string cleaned = StripLampacArgs(masterUrl?.Trim()); + return UpdateService.Validate(Redirect(HostStreamProxy(init, cleaned, proxy: proxyManager.Get()))); } if (itemType == "Фільм") @@ -140,5 +141,21 @@ namespace Unimay.Controllers return OnError("unsupported type"); }); } + + private static string StripLampacArgs(string url) + { + if (string.IsNullOrEmpty(url)) + return url; + + string cleaned = System.Text.RegularExpressions.Regex.Replace( + url, + @"([?&])(account_email|uid|nws_id)=[^&]*", + "$1", + System.Text.RegularExpressions.RegexOptions.IgnoreCase + ); + + cleaned = cleaned.Replace("?&", "?").Replace("&&", "&").TrimEnd('?', '&'); + return cleaned; + } } }