1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-27 10:18:55 +00:00

lostfilm: Remove CsQuery and use AngleSharp instead #7292 (#7328)

also add missing torznab fields not available from results
This commit is contained in:
Diego Heras 2020-02-25 21:04:36 +01:00 committed by GitHub
parent c339d54aed
commit 2f694147a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,6 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AngleSharp.Dom;
using AngleSharp.Html.Parser;
using CsQuery;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig;
using Jackett.Common.Services.Interfaces;
@ -108,12 +107,13 @@ namespace Jackett.Common.Indexers
{
// looks like after some failed login attempts there's a captcha
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
CQ dom = loginPage.Content;
var qCaptchaImg = dom.Find("img#captcha_pictcha").First();
if (qCaptchaImg.Length == 1)
var parser = new HtmlParser();
var document = parser.ParseDocument(loginPage.Content);
var qCaptchaImg = document.QuerySelector("img#captcha_pictcha");
if (qCaptchaImg != null)
{
var CaptchaUrl = SiteLink + qCaptchaImg.Attr("src");
var captchaImage = await RequestBytesWithCookies(CaptchaUrl, loginPage.Cookies);
var captchaUrl = SiteLink + qCaptchaImg.GetAttribute("src");
var captchaImage = await RequestBytesWithCookies(captchaUrl, loginPage.Cookies);
configData.CaptchaImage.Value = captchaImage.Content;
}
else
@ -720,6 +720,14 @@ namespace Jackett.Common.Indexers
sizeString = sizeString.Replace("КБ", "KB"); // untested
release.Size = ReleaseInfo.GetBytes(sizeString);
// add missing torznab fields not available from results
release.Seeders = 1;
release.Peers = 2;
release.DownloadVolumeFactor = 0;
release.UploadVolumeFactor = 1;
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800; // 48 hours
logger.Debug("> Add: " + release.Title);
releases.Add(release);
}