mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-06-17 12:08:54 +00:00
fix(uaflix): skip probing unreleased premiere episodes
Mark season episodes whose description title contains «Прем'єра» and skip player probing for them. This avoids unnecessary HTTP requests for episodes that have not aired yet.
This commit is contained in:
parent
3ee62e24f6
commit
e695121444
@ -19,5 +19,12 @@ namespace LME.Uaflix.Models
|
|||||||
/// Перший елемент відповідає iframeUrl, наступні — додаткові плеєри (напр. з субтитрами)
|
/// Перший елемент відповідає iframeUrl, наступні — додаткові плеєри (напр. з субтитрами)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> zetvideoIframeUrls { get; set; }
|
public List<string> zetvideoIframeUrls { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Епізод позначено як «Прем'єра» (ще не вийшов) на сторінці сезону.
|
||||||
|
/// У таких епізодів у vi-desc → vi-title зазначено "Прем'єра. ДД.ММ.РРРР".
|
||||||
|
/// ProbeSeasonPlayer не робитиме зайвого HTTP-запиту для таких епізодів.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsPremiere { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,6 +361,14 @@ namespace LME.Uaflix
|
|||||||
if (episode == null || string.IsNullOrWhiteSpace(episode.url))
|
if (episode == null || string.IsNullOrWhiteSpace(episode.url))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Пропускаємо епізоди, позначені як «Прем'єра» — вони ще не вийшли,
|
||||||
|
// робити зайвий HTTP-запит на сторінку епізоду не потрібно.
|
||||||
|
if (episode.IsPremiere)
|
||||||
|
{
|
||||||
|
_onLog($"ProbeSeasonPlayer: Пропускаю епізод {episode.episode} — позначено як прем'єра");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var probed = await ProbeEpisodePlayer(episode.url);
|
var probed = await ProbeEpisodePlayer(episode.url);
|
||||||
if (probed == null)
|
if (probed == null)
|
||||||
continue;
|
continue;
|
||||||
@ -1084,13 +1092,28 @@ namespace LME.Uaflix
|
|||||||
parsedEpisode = episodeFromUrl;
|
parsedEpisode = episodeFromUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
episodes.Add(new EpisodeLinkInfo
|
var episode = new EpisodeLinkInfo
|
||||||
{
|
{
|
||||||
url = episodeUrl,
|
url = episodeUrl,
|
||||||
title = episodeNode.SelectSingleNode(".//div[@class='vi-rate']")?.InnerText.Trim() ?? $"Епізод {parsedEpisode}",
|
title = episodeNode.SelectSingleNode(".//div[@class='vi-rate']")?.InnerText.Trim() ?? $"Епізод {parsedEpisode}",
|
||||||
season = parsedSeason,
|
season = parsedSeason,
|
||||||
episode = parsedEpisode
|
episode = parsedEpisode
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Перевірка на «Прем'єра» — епізод ще не вийшов, плеєра немає
|
||||||
|
var viDesc = episodeNode.SelectSingleNode(".//div[contains(@class, 'vi-desc')]");
|
||||||
|
if (viDesc != null)
|
||||||
|
{
|
||||||
|
var viTitle = viDesc.SelectSingleNode(".//div[contains(@class, 'vi-title')]");
|
||||||
|
string descText = viTitle?.InnerText?.Trim() ?? string.Empty;
|
||||||
|
if (descText.IndexOf("Прем'єра", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||||
|
{
|
||||||
|
episode.IsPremiere = true;
|
||||||
|
_onLog($"ParseSeasonEpisodesFromHtml: Серія {parsedEpisode} позначена як прем'єра: '{descText}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
episodes.Add(episode);
|
||||||
|
|
||||||
fallbackEpisode = Math.Max(fallbackEpisode, parsedEpisode + 1);
|
fallbackEpisode = Math.Max(fallbackEpisode, parsedEpisode + 1);
|
||||||
}
|
}
|
||||||
@ -1954,16 +1977,31 @@ namespace LME.Uaflix
|
|||||||
|
|
||||||
var match = Regex.Match(episodeUrl, @"season-(\d+).*?episode-(\d+)");
|
var match = Regex.Match(episodeUrl, @"season-(\d+).*?episode-(\d+)");
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
|
{
|
||||||
|
var ep = new EpisodeLinkInfo
|
||||||
|
{
|
||||||
|
url = episodeUrl,
|
||||||
|
title = episodeNode.SelectSingleNode(".//div[@class='vi-rate']")?.InnerText.Trim() ?? $"Епізод {match.Groups[2].Value}",
|
||||||
|
season = int.Parse(match.Groups[1].Value),
|
||||||
|
episode = int.Parse(match.Groups[2].Value)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Перевірка на «Прем'єра» — епізод ще не вийшов
|
||||||
|
var viDesc = episodeNode.SelectSingleNode(".//div[contains(@class, 'vi-desc')]");
|
||||||
|
if (viDesc != null)
|
||||||
|
{
|
||||||
|
var viTitle = viDesc.SelectSingleNode(".//div[contains(@class, 'vi-title')]");
|
||||||
|
string descText = viTitle?.InnerText?.Trim() ?? string.Empty;
|
||||||
|
if (descText.IndexOf("Прем'єра", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||||
{
|
{
|
||||||
allEpisodes.Add(new EpisodeLinkInfo
|
ep.IsPremiere = true;
|
||||||
{
|
_onLog($"GetPaginationInfo: Серія {ep.episode} позначена як прем'єра: '{descText}'");
|
||||||
url = episodeUrl,
|
|
||||||
title = episodeNode.SelectSingleNode(".//div[@class='vi-rate']")?.InnerText.Trim() ?? $"Епізод {match.Groups[2].Value}",
|
|
||||||
season = int.Parse(match.Groups[1].Value),
|
|
||||||
episode = int.Parse(match.Groups[2].Value)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allEpisodes.Add(ep);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user