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

44 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Mvc;
namespace SISI.Controllers.PornHubPremium
{
public class ListController : BaseSisiController
{
public ListController() : base(AppInit.conf.PornHubPremium) { }
[HttpGet]
[Route("phubprem")]
async public Task<ActionResult> Prem(string search, string model, string sort, string hd, int c, int pg = 1)
{
if (await IsRequestBlocked(rch: false))
return badInitMsg;
string memKey = $"phubprem:list:{search}:{model}:{sort}:{hd}:{pg}";
if (!hybridCache.TryGetValue(memKey, out (int total_pages, List<PlaylistItem> playlists) cache))
{
string uri = PornHubTo.Uri(init.corsHost(), "phubprem", search, model, sort, c, hd, pg);
string html = await Http.Get(init.cors(uri), timeoutSeconds: 14, proxy: proxy, httpversion: 2, headers: httpHeaders(init, HeadersModel.Init("cookie", init.cookie)));
if (html == null)
return OnError("html", refresh_proxy: string.IsNullOrEmpty(search));
cache.total_pages = PornHubTo.Pages(html);
cache.playlists = PornHubTo.Playlist("phubprem/vidosik", "phubprem", html, prem: true);
if (cache.playlists.Count == 0)
return OnError("playlists", refresh_proxy: pg > 1 && string.IsNullOrEmpty(search));
proxyManager?.Success();
hybridCache.Set(memKey, cache, cacheTime(10));
}
return await PlaylistResult(
cache.playlists,
false,
string.IsNullOrEmpty(model) ? PornHubTo.Menu(host, "phubprem", search, sort, c, hd) : null,
total_pages: cache.total_pages
);
}
}
}