Skip to content

Commit

Permalink
fix jac web
Browse files Browse the repository at this point in the history
  • Loading branch information
immisterio committed Dec 15, 2022
1 parent 39b9663 commit 33fb618
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
34 changes: 32 additions & 2 deletions Controllers/JAC/JackettController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,44 @@ async public Task<JsonResult> JacRed(string apikey, string search)
}
#endregion

#region getSizeInfo
long getSizeInfo(string sizeName)
{
if (string.IsNullOrWhiteSpace(sizeName))
return 0;

try
{
double size = 0.1;
var gsize = Regex.Match(sizeName, "([0-9\\.,]+) (Mb|МБ|GB|ГБ|TB|ТБ)", RegexOptions.IgnoreCase).Groups;
if (!string.IsNullOrWhiteSpace(gsize[2].Value))
{
if (double.TryParse(gsize[1].Value.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out size) && size != 0)
{
if (gsize[2].Value.ToLower() is "gb" or "гб")
size *= 1024;

if (gsize[2].Value.ToLower() is "tb" or "тб")
size *= 1048576;

return (long)(size * 1048576);
}
}
}
catch { }

return 0;
}
#endregion

var torrents = await Torrents(search, null, null, 0, 0, null);

return Json(torrents.Take(5_000).Select(i => new
return Json(torrents.Select(i => new
{
tracker = i.trackerName,
url = i.url != null && i.url.StartsWith("http") ? i.url : null,
i.title,
size = (long)(i.size * 1048576),
size = getSizeInfo(i.sizeName),
i.sizeName,
i.createTime,
i.sid,
Expand Down
2 changes: 1 addition & 1 deletion Controllers/SISI/Xvideos/ViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async public Task<ActionResult> Index(string goni)
if (string.IsNullOrWhiteSpace(line) || !line.StartsWith("hls-"))
continue;

string hls = $"{Regex.Replace(cache.stream_link.Replace("https:", "http:"), "/hls.m3u8.*", "")}/{line}";
string hls = $"{Regex.Replace(cache.stream_link, "/hls.m3u8.*", "")}/{line}";
playlists.Add(new PlaylistItem()
{
name = new Regex("hls-([0-9]+)p").Match(line).Groups[1].Value,
Expand Down
1 change: 1 addition & 0 deletions Engine/Middlewares/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static IApplicationBuilder UseProxyAPI(this IApplicationBuilder builder)
{
return builder.UseMiddleware<ProxyAPI>();
}

public static IApplicationBuilder UseProxyIMG(this IApplicationBuilder builder)
{
return builder.UseMiddleware<ProxyImg>();
Expand Down

0 comments on commit 33fb618

Please sign in to comment.