1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-01-01 12:46:23 +00:00

mejortorrent: fix download link. resolves #10659 (#10709)

This commit is contained in:
Diego Heras 2021-01-02 12:54:45 +01:00 committed by GitHub
parent 80b0b934ae
commit dae3248719
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));