1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-01-04 06:22:45 +00:00

speedcd: fix new layout. resolves #8392 (#8399)

This commit is contained in:
Diego Heras 2020-04-28 22:36:42 +02:00 committed by GitHub
parent 867080f221
commit 90dc75597d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AngleSharp.Html.Parser; using AngleSharp.Html.Parser;
using Jackett.Common.Helpers;
using Jackett.Common.Models; using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig; using Jackett.Common.Models.IndexerConfig;
using Jackett.Common.Services.Interfaces; using Jackett.Common.Services.Interfaces;
@ -17,7 +18,7 @@ namespace Jackett.Common.Indexers
{ {
public class SpeedCD : BaseWebIndexer public class SpeedCD : BaseWebIndexer
{ {
private string SearchUrl => SiteLink + "browse.php"; private string SearchUrl => SiteLink + "browse/";
public override string[] AlternativeSiteLinks { get; protected set; } = { public override string[] AlternativeSiteLinks { get; protected set; } = {
"https://speed.cd/", "https://speed.cd/",
@ -105,20 +106,26 @@ namespace Jackett.Common.Indexers
{ {
var releases = new List<ReleaseInfo>(); var releases = new List<ReleaseInfo>();
var qc = new List<KeyValuePair<string, string>>(); // NameValueCollection don't support c[]=30&c[]=52 // the order of the params is important!
if (query.IsImdbQuery) var qc = new List<string>();
{
qc.Add("search", query.ImdbID);
qc.Add("d", "on");
}
else
qc.Add("search", query.GetQueryString());
var catList = MapTorznabCapsToTrackers(query); var catList = MapTorznabCapsToTrackers(query);
foreach (var cat in catList) foreach (var cat in catList)
qc.Add("c[]", cat); qc.Add(cat);
var searchUrl = SearchUrl + "?" + qc.GetQueryString(); if (query.IsImdbQuery)
{
qc.Add("deep");
qc.Add("q");
qc.Add(query.ImdbID);
}
else
{
qc.Add("q");
qc.Add(WebUtilityHelpers.UrlEncode(query.GetQueryString(), Encoding));
}
var searchUrl = SearchUrl + string.Join("/", qc);
var response = await RequestStringWithCookiesAndRetry(searchUrl); var response = await RequestStringWithCookiesAndRetry(searchUrl);
if (!response.Content.Contains("/logout.php")) if (!response.Content.Contains("/logout.php"))
throw new Exception("The user is not logged in. It is possible that the cookie has expired or you " + throw new Exception("The user is not logged in. It is possible that the cookie has expired or you " +
@ -137,15 +144,15 @@ namespace Jackett.Common.Indexers
var title = row.QuerySelector("td[class='lft'] > div > a").TextContent.Trim(); var title = row.QuerySelector("td[class='lft'] > div > a").TextContent.Trim();
var link = new Uri(SiteLink + row.QuerySelector("img[title='Download']").ParentElement.GetAttribute("href").TrimStart('/')); var link = new Uri(SiteLink + row.QuerySelector("img[title='Download']").ParentElement.GetAttribute("href").TrimStart('/'));
var comments = new Uri(SiteLink + row.QuerySelector("td[class='lft'] > div > a").GetAttribute("href").TrimStart('/')); var comments = new Uri(SiteLink + row.QuerySelector("td[class='lft'] > div > a").GetAttribute("href").TrimStart('/'));
var size = ReleaseInfo.GetBytes(cells[4].TextContent); var size = ReleaseInfo.GetBytes(cells[5].TextContent);
var grabs = ParseUtil.CoerceInt(cells[5].TextContent); var grabs = ParseUtil.CoerceInt(cells[6].TextContent);
var seeders = ParseUtil.CoerceInt(cells[6].TextContent); var seeders = ParseUtil.CoerceInt(cells[7].TextContent);
var leechers = ParseUtil.CoerceInt(cells[7].TextContent); var leechers = ParseUtil.CoerceInt(cells[8].TextContent);
var pubDateStr = row.QuerySelector("span[class^='elapsedDate']").GetAttribute("title").Replace(" at", ""); var pubDateStr = row.QuerySelector("span[class^='elapsedDate']").GetAttribute("title").Replace(" at", "");
var publishDate = DateTime.ParseExact(pubDateStr, "dddd, MMMM d, yyyy h:mmtt", CultureInfo.InvariantCulture); var publishDate = DateTime.ParseExact(pubDateStr, "dddd, MMMM d, yyyy h:mmtt", CultureInfo.InvariantCulture);
var cat = row.QuerySelector("a[href^='?c[]=']").GetAttribute("href").Replace("?c[]=", ""); var cat = row.QuerySelector("a").GetAttribute("href").Split('/').Last();
var downloadVolumeFactor = row.QuerySelector("span:contains(\"[Freeleech]\")") != null ? 0 : 1; var downloadVolumeFactor = row.QuerySelector("span:contains(\"[Freeleech]\")") != null ? 0 : 1;
var release = new ReleaseInfo var release = new ReleaseInfo