mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
100500 fix CikavaIdeya
This commit is contained in:
parent
0ef0908303
commit
e6bd82dd01
@ -270,6 +270,17 @@ namespace CikavaIdeya
|
|||||||
// Якщо це вже iframe URL (наприклад, з switches), повертаємо його
|
// Якщо це вже iframe URL (наприклад, з switches), повертаємо його
|
||||||
if (url.Contains("ashdi.vip"))
|
if (url.Contains("ashdi.vip"))
|
||||||
{
|
{
|
||||||
|
_onLog($"ParseEpisode: URL contains ashdi.vip, calling GetStreamUrlFromAshdi");
|
||||||
|
string streamUrl = await GetStreamUrlFromAshdi(url);
|
||||||
|
_onLog($"ParseEpisode: GetStreamUrlFromAshdi returned {streamUrl}");
|
||||||
|
if (!string.IsNullOrEmpty(streamUrl))
|
||||||
|
{
|
||||||
|
result.streams.Add((streamUrl, "hls"));
|
||||||
|
_onLog($"ParseEpisode: added stream URL to result.streams");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Якщо не вдалося отримати посилання на поток, повертаємо iframe URL
|
||||||
|
_onLog($"ParseEpisode: stream URL is null or empty, setting iframe_url");
|
||||||
result.iframe_url = url;
|
result.iframe_url = url;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -296,6 +307,45 @@ namespace CikavaIdeya
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public async Task<string> GetStreamUrlFromAshdi(string url)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: trying to get stream URL from {url}");
|
||||||
|
var headers = new List<HeadersModel>() { new HeadersModel("User-Agent", "Mozilla/5.0"), new HeadersModel("Referer", "https://ashdi.vip/") };
|
||||||
|
string html = await Http.Get(url, headers: headers, proxy: _proxyManager.Get());
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: received HTML, length={html.Length}");
|
||||||
|
|
||||||
|
// Знаходимо JavaScript код з об'єктом player
|
||||||
|
var match = Regex.Match(html, @"var\s+player\s*=\s*new\s+Playerjs[\s\S]*?\(\s*({[\s\S]*?})\s*\)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: found player object");
|
||||||
|
string playerJson = match.Groups[1].Value;
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: playerJson={playerJson}");
|
||||||
|
// Знаходимо поле file
|
||||||
|
var fileMatch = Regex.Match(playerJson, @"file\s*:\s*[""]?([^\s,""}]+)[""]?", RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
||||||
|
if (fileMatch.Success)
|
||||||
|
{
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: found file URL: {fileMatch.Groups[1].Value}");
|
||||||
|
return fileMatch.Groups[1].Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: file URL not found in playerJson");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_onLog($"GetStreamUrlFromAshdi: player object not found in HTML");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_onLog($"GetStreamUrlFromAshdi error: {ex.Message}");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static TimeSpan cacheTime(int multiaccess, int home = 5, int mikrotik = 2, OnlinesSettings init = null, int rhub = -1)
|
public static TimeSpan cacheTime(int multiaccess, int home = 5, int mikrotik = 2, OnlinesSettings init = null, int rhub = -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,10 +47,19 @@ namespace CikavaIdeya.Controllers
|
|||||||
if (episode == null)
|
if (episode == null)
|
||||||
return Content("CikavaIdeya", "text/html; charset=utf-8");
|
return Content("CikavaIdeya", "text/html; charset=utf-8");
|
||||||
|
|
||||||
|
OnLog($"Controller: calling invoke.ParseEpisode with URL: {episode.url}");
|
||||||
var playResult = await invoke.ParseEpisode(episode.url);
|
var playResult = await invoke.ParseEpisode(episode.url);
|
||||||
|
OnLog($"Controller: invoke.ParseEpisode returned playResult with streams.Count={playResult.streams?.Count ?? 0}, iframe_url={playResult.iframe_url}");
|
||||||
|
|
||||||
|
if (playResult.streams != null && playResult.streams.Count > 0)
|
||||||
|
{
|
||||||
|
OnLog($"Controller: redirecting to stream URL: {playResult.streams.First().link}");
|
||||||
|
return Redirect(HostStreamProxy(init, accsArgs(playResult.streams.First().link)));
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(playResult.iframe_url))
|
if (!string.IsNullOrEmpty(playResult.iframe_url))
|
||||||
{
|
{
|
||||||
|
OnLog($"Controller: redirecting to iframe URL: {playResult.iframe_url}");
|
||||||
// Для CikavaIdeya ми просто повертаємо iframe URL
|
// Для CikavaIdeya ми просто повертаємо iframe URL
|
||||||
return Redirect(playResult.iframe_url);
|
return Redirect(playResult.iframe_url);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user