lampac/SISI/Controllers/Xvideos/ViewController.cs
lampac-talks f843f04fd4 chore: initial commit 154.3
Signed-off-by: lampac-talks <lampac-talks@users.noreply.github.com>
2026-01-30 16:23:09 +03:00

46 lines
1.4 KiB
C#

using Microsoft.AspNetCore.Mvc;
namespace SISI.Controllers.Xvideos
{
public class ViewController : BaseSisiController
{
public ViewController() : base(AppInit.conf.Xvideos) { }
[HttpGet]
[Route("xds/vidosik")]
async public Task<ActionResult> Index(string uri, bool related)
{
if (await IsRequestBlocked(rch: true))
return badInitMsg;
rhubFallback:
var cache = await InvokeCacheResult<StreamItem>($"xvideos:view:{uri}", 20, async e =>
{
string url = XvideosTo.StreamLinksUri($"{host}/xds/stars", init.corsHost(), uri);
if (url == null)
return e.Fail("uri");
StreamItem stream_links = null;
await httpHydra.GetSpan(url, span =>
{
stream_links = XvideosTo.StreamLinks(span, "xds/vidosik", $"{host}/xds/stars");
});
if (stream_links?.qualitys == null || stream_links.qualitys.Count == 0)
return e.Fail("stream_links", refresh_proxy: true);
return e.Success(stream_links);
});
if (IsRhubFallback(cache))
goto rhubFallback;
if (related)
return await PlaylistResult(cache.Value?.recomends, cache.ISingleCache, null, total_pages: 1);
return OnResult(cache);
}
}
}