From dae3248719d686752aaad1fbd4eea2bd4d14dafb Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Sat, 2 Jan 2021 12:54:45 +0100 Subject: [PATCH] mejortorrent: fix download link. resolves #10659 (#10709) --- src/Jackett.Common/Indexers/MejorTorrent.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/MejorTorrent.cs b/src/Jackett.Common/Indexers/MejorTorrent.cs index 5fcf3a818..7917fc70f 100644 --- a/src/Jackett.Common/Indexers/MejorTorrent.cs +++ b/src/Jackett.Common/Indexers/MejorTorrent.cs @@ -132,7 +132,18 @@ namespace Jackett.Common.Indexers if (result.Status != HttpStatusCode.OK) throw new ExceptionWithConfigData(result.ContentString, configData); dom = parser.ParseDocument(result.ContentString); - downloadUrl = SiteLink + dom.QuerySelector("a[href^=\"/tor/\"]").GetAttribute("href"); + + // There are several types of download links + // 1. Direct link https://www.mejortorrentt.net/tor/peliculas/Harry_Potter_1_y_la_Piedra_Filosofal_MicroHD_1080p.torrent + var selector = dom.QuerySelector("a[href^=\"/tor/\"]"); + if (selector != null) + downloadUrl = SiteLink + selector.GetAttribute("href"); + else + { + // 2. Hidden link onclick="post('https://cdn1.mejortorrents.net/torrents/xcceijidcd', {table: 'peliculas', name: 'Harry_Potter_1_y_la_Piedra_Filosofal_MicroHD_1080p.torrent'});" + var onClickParts = dom.QuerySelector("a[onclick*=\"/torrent\"]").GetAttribute("onclick").Split('\''); + downloadUrl = $"{SiteLink}tor/{onClickParts[3]}/{onClickParts[5]}"; + } // Eg https://www.mejortorrentt.net/tor/peliculas/Harry_Potter_1_y_la_Piedra_Filosofal_MicroHD_1080p.torrent var content = await base.Download(new Uri(downloadUrl));