mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
fix(media): improve stream URL handling and regex pattern
- Fix regex pattern in CikavaIdeyaInvoke.cs to properly match quoted file URLs - Simplify stream URL handling in Controller.cs by removing redundant proxy logic - Ensure consistent file endings by adding newline to CikavaIdeyaInvoke.cs
This commit is contained in:
parent
497dbc2b09
commit
cd67ea1639
@ -324,7 +324,7 @@ namespace CikavaIdeya
|
|||||||
string playerJson = match.Groups[1].Value;
|
string playerJson = match.Groups[1].Value;
|
||||||
_onLog($"GetStreamUrlFromAshdi: playerJson={playerJson}");
|
_onLog($"GetStreamUrlFromAshdi: playerJson={playerJson}");
|
||||||
// Знаходимо поле file
|
// Знаходимо поле file
|
||||||
var fileMatch = Regex.Match(playerJson, @"file\s*:\s*[""]?([^\s,""}]+)[""]?", RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
var fileMatch = Regex.Match(playerJson, @"file\s*:\s*['""]([^'""]+)['""]", RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
||||||
if (fileMatch.Success)
|
if (fileMatch.Success)
|
||||||
{
|
{
|
||||||
_onLog($"GetStreamUrlFromAshdi: found file URL: {fileMatch.Groups[1].Value}");
|
_onLog($"GetStreamUrlFromAshdi: found file URL: {fileMatch.Groups[1].Value}");
|
||||||
@ -359,4 +359,4 @@ namespace CikavaIdeya
|
|||||||
return TimeSpan.FromMinutes(ctime);
|
return TimeSpan.FromMinutes(ctime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,26 +54,7 @@ namespace CikavaIdeya.Controllers
|
|||||||
if (playResult.streams != null && playResult.streams.Count > 0)
|
if (playResult.streams != null && playResult.streams.Count > 0)
|
||||||
{
|
{
|
||||||
string streamLink = playResult.streams.First().link;
|
string streamLink = playResult.streams.First().link;
|
||||||
List<HeadersModel> streamHeaders = null;
|
string streamUrl = HostStreamProxy(init, accsArgs(streamLink));
|
||||||
bool forceProxy = false;
|
|
||||||
|
|
||||||
if (streamLink.Contains("ashdi.vip", StringComparison.OrdinalIgnoreCase) && init.streamproxy)
|
|
||||||
{
|
|
||||||
streamHeaders = new List<HeadersModel>()
|
|
||||||
{
|
|
||||||
new HeadersModel("User-Agent", "Mozilla/5.0"),
|
|
||||||
new HeadersModel("Referer", "https://ashdi.vip/")
|
|
||||||
};
|
|
||||||
forceProxy = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
string streamUrl = HostStreamProxy(init, streamLink, headers: streamHeaders, force_streamproxy: forceProxy);
|
|
||||||
if (!string.IsNullOrEmpty(streamUrl) &&
|
|
||||||
streamUrl.StartsWith($"{host}/proxy/", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
streamUrl = accsArgs(streamUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
OnLog($"Controller: redirecting to stream URL: {streamUrl}");
|
OnLog($"Controller: redirecting to stream URL: {streamUrl}");
|
||||||
return Redirect(streamUrl);
|
return Redirect(streamUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user