morethantv: update scraper to use torrents/browse endpoint (#13106)

This commit is contained in:
missingfile
2022-04-02 11:45:34 -07:00
committed by GitHub
parent 3943302e0d
commit 3938b4ecb4

View File

@@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers
}; };
private string LoginUrl => SiteLink + "login"; private string LoginUrl => SiteLink + "login";
private string BrowseUrl => SiteLink + "torrents.php"; private string BrowseUrl => SiteLink + "torrents/browse";
private string DownloadUrl => SiteLink + "torrents.php";
private string DetailsUrl => SiteLink + "details.php"; private string DetailsUrl => SiteLink + "details.php";
private string _sort; private string _sort;
@@ -230,7 +231,7 @@ namespace Jackett.Common.Indexers
if (query.Categories.Contains(TorznabCatType.TV.ID)) if (query.Categories.Contains(TorznabCatType.TV.ID))
{ {
qc.Add("filter_cat[3]", "1"); // HD EPISODE qc.Add("filter_cat[3]", "1"); // HD Episode
qc.Add("filter_cat[4]", "1"); // SD Episode qc.Add("filter_cat[4]", "1"); // SD Episode
qc.Add("filter_cat[5]", "1"); // HD Season qc.Add("filter_cat[5]", "1"); // HD Season
qc.Add("filter_cat[6]", "1"); // SD Season qc.Add("filter_cat[6]", "1"); // SD Season
@@ -262,10 +263,8 @@ namespace Jackett.Common.Indexers
foreach (var torrent in torrents) foreach (var torrent in torrents)
{ {
// Parse required data // Parse required data
var torrentGroup = torrent.QuerySelectorAll("table a[href^=\"/torrents.php?action=download\"]"); var downloadAnchor = torrent.QuerySelector("span a[href^=\"/torrents.php?action=download\"]");
foreach (var downloadAnchor in torrentGroup) var title = downloadAnchor.ParentElement.ParentElement.ParentElement.QuerySelector("a[class=\"overlay_torrent\"]").TextContent.Trim();
{
var title = downloadAnchor.ParentElement.ParentElement.ParentElement.TextContent.Trim();
title = CleanUpTitle(title); title = CleanUpTitle(title);
var category = torrent.QuerySelector(".cats_col div").GetAttribute("title"); var category = torrent.QuerySelector(".cats_col div").GetAttribute("title");
@@ -280,7 +279,6 @@ namespace Jackett.Common.Indexers
releases.Add(GetReleaseInfo(torrent, downloadAnchor, title, categoryId)); releases.Add(GetReleaseInfo(torrent, downloadAnchor, title, categoryId));
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
OnParseError(response.ContentString, ex); OnParseError(response.ContentString, ex);
@@ -299,7 +297,7 @@ namespace Jackett.Common.Indexers
{ {
// count from bottom // count from bottom
const int FILES_COL = 8; const int FILES_COL = 7;
/*const int COMMENTS_COL = 7;*/ /*const int COMMENTS_COL = 7;*/
const int DATE_COL = 6; const int DATE_COL = 6;
const int FILESIZE_COL = 5; const int FILESIZE_COL = 5;
@@ -337,7 +335,7 @@ namespace Jackett.Common.Indexers
var seeders = int.Parse(seeds, NumberStyles.AllowThousands, CultureInfo.InvariantCulture); var seeders = int.Parse(seeds, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
var leechers = int.Parse(leechs, NumberStyles.AllowThousands, CultureInfo.InvariantCulture); var leechers = int.Parse(leechs, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
var detailsUri = new Uri(DetailsUrl + "?torrentid=" + torrentId); var detailsUri = new Uri(DetailsUrl + "?torrentid=" + torrentId);
var downloadLink = new Uri(BrowseUrl + "?action=download&id=" + torrentId); var downloadLink = new Uri(DownloadUrl + "?action=download&id=" + torrentId);
return new ReleaseInfo return new ReleaseInfo
{ {