mejortorrent: fix download link (#9018)

This commit is contained in:
Diego Heras 2020-06-21 07:47:58 +02:00 committed by GitHub
parent 454350dfaf
commit 396c638f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -100,21 +100,22 @@ namespace Jackett.Common.Indexers
var parser = new HtmlParser();
var downloadUrl = link.ToString();
// Eg http://www.mejortorrentt.org/peli-descargar-torrent-11995-Harry-Potter-y-la-piedra-filosofal.html
// Eg https://www.mejortorrentt.net/peli-descargar-torrent-11995-Harry-Potter-y-la-piedra-filosofal.html
var result = await RequestStringWithCookies(downloadUrl);
if (result.Status != HttpStatusCode.OK)
throw new ExceptionWithConfigData(result.Content, configData);
var dom = parser.ParseDocument(result.Content);
downloadUrl = SiteLink + dom.QuerySelector("a[href*=\"sec=descargas\"]").GetAttribute("href");
// Eg http://www.mejortorrentt.org/secciones.php?sec=descargas&ap=contar&tabla=peliculas&id=11995&link_bajar=1
// Eg https://www.mejortorrentt.net/secciones.php?sec=descargas&ap=contar&tabla=peliculas&id=11995&link_bajar=1
result = await RequestStringWithCookies(downloadUrl);
if (result.Status != HttpStatusCode.OK)
throw new ExceptionWithConfigData(result.Content, configData);
dom = parser.ParseDocument(result.Content);
downloadUrl = SiteLink + dom.QuerySelector("a[href*=\".torrent\"]").GetAttribute("href").TrimStart('/');
var onClickParts = dom.QuerySelector("a[onclick*=\"/torrent\"]").GetAttribute("onclick").Split('\'');
downloadUrl = $"{SiteLink}tor/{onClickParts[3]}/{onClickParts[5]}";
// Eg https://www.mejortorrentt.org/uploads/torrents/peliculas/Harry_Potter_1_y_la_Piedra_Filosofal_MicroHD_1080p.torrent
// 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));
return content;
}