morethantv: add banner and description. resolves #7594 (#7621)

This commit is contained in:
Diego Heras 2020-03-11 00:53:12 +01:00 committed by GitHub
parent 4eb7392678
commit 5c16161bfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 10 deletions

View File

@ -246,33 +246,37 @@ namespace Jackett.Common.Indexers
private ReleaseInfo GetReleaseInfo(IElement row, IElement downloadAnchor, string title, int category)
{
// Parse required data
var downloadAnchorHref = downloadAnchor.Attributes["href"].Value;
var torrentId = downloadAnchorHref.Substring(downloadAnchorHref.LastIndexOf('=') + 1);
var qFiles = row.QuerySelector("td:nth-last-child(6)");
var files = ParseUtil.CoerceLong(qFiles.TextContent);
var publishDate = DateTime.ParseExact(row.QuerySelector(".time.tooltip").Attributes["title"].Value, "MMM dd yyyy, HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
var torrentData = row.QuerySelectorAll(".number_column"); // Size (xx.xx GB[ (Max)]) Snatches (xx) Seeders (xx) Leechers (xx)
if (torrentData.Length != 4)
throw new Exception($"We expected 4 torrent datas, instead we have {torrentData.Length}.");
if (torrentId.Contains('#'))
torrentId = torrentId.Split('#')[0];
var qFiles = row.QuerySelector("td:nth-last-child(6)");
var files = ParseUtil.CoerceLong(qFiles.TextContent);
var qPublishDate = row.QuerySelector(".time.tooltip").Attributes["title"].Value;
var publishDate = DateTime.ParseExact(qPublishDate, "MMM dd yyyy, HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
var qBanner = row.QuerySelector("div.tp-banner img")?.GetAttribute("src");
var banner = (qBanner != null && !qBanner.Contains("/static/styles/")) ? new Uri(qBanner) : null;
var description = row.QuerySelector("div.tags")?.TextContent.Trim();
var torrentData = row.QuerySelectorAll(".number_column");
if (torrentData.Length != 4) // Size (xx.xx GB[ (Max)]) Snatches (xx) Seeders (xx) Leechers (xx)
throw new Exception($"We expected 4 torrent datas, instead we have {torrentData.Length}.");
var size = ReleaseInfo.GetBytes(torrentData[0].TextContent);
var grabs = int.Parse(torrentData[1].TextContent, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
var seeders = int.Parse(torrentData[2].TextContent, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
var leechers = int.Parse(torrentData[3].TextContent, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
var guid = new Uri(GuidUrl + torrentId);
// Build releaseinfo
return new ReleaseInfo
{
Title = title,
Category = new List<int> { category }, // Who seasons movies right
Link = new Uri(DownloadUrl + torrentId),
PublishDate = publishDate,
BannerUrl = banner,
Description = description,
Seeders = seeders,
Peers = seeders + leechers,
Files = files,