using Microsoft.AspNetCore.Mvc; using Shared.PlaywrightCore; namespace SISI.Controllers.Spankbang { public class ViewController : BaseSisiController { public ViewController() : base(AppInit.conf.Spankbang) { } [HttpGet] [Route("sbg/vidosik")] async public Task Index(string uri, bool related) { if (await IsRequestBlocked(rch: true)) return badInitMsg; rhubFallback: var cache = await InvokeCacheResult($"spankbang:view:{uri}", 20, async e => { string url = SpankbangTo.StreamLinksUri(init.corsHost(), uri); if (url == null) return e.Fail("uri"); StreamItem stream_links = null; if (rch?.enable == true || init.priorityBrowser == "http") { await httpHydra.GetSpan(url, span => { stream_links = SpankbangTo.StreamLinks("sbg/vidosik", span); }); } else { string html = await PlaywrightBrowser.Get(init, url, httpHeaders(init), proxy_data); stream_links = SpankbangTo.StreamLinks("sbg/vidosik", html); } 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); } } }