mirror of
https://github.com/Jackett/Jackett
synced 2025-02-25 15:42:48 +00:00
Allow AlternateLink configuration for TorrentDay (#577)
* Allow AlternateLink configuration for TorrentDay * Allow AlternateLink configuration for TorrentDay
This commit is contained in:
parent
f04a97f237
commit
51cb8762b1
3 changed files with 58 additions and 10 deletions
|
@ -21,13 +21,27 @@ namespace Jackett.Indexers
|
|||
{
|
||||
public class TorrentDay : BaseIndexer, IIndexer
|
||||
{
|
||||
private string StartPageUrl { get { return SiteLink + "login.php"; } }
|
||||
private string LoginUrl { get { return SiteLink + "tak3login.php"; } }
|
||||
private string SearchUrl { get { return SiteLink + "browse.php"; } }
|
||||
private string UseLink { get { return (!String.IsNullOrEmpty(this.configData.AlternateLink.Value) ? this.configData.AlternateLink.Value : SiteLink); } }
|
||||
private string StartPageUrl { get { return UseLink + "login.php"; } }
|
||||
private string LoginUrl { get { return UseLink + "tak3login.php"; } }
|
||||
private string SearchUrl { get { return UseLink + "browse.php"; } }
|
||||
private List<String> KnownURLs = new List<String> {
|
||||
"https://tdonline.org/",
|
||||
"https://secure.torrentday.com/",
|
||||
"https://torrentday.eu/",
|
||||
"https://torrentday.it/",
|
||||
"https://classic.torrentday.com/",
|
||||
"https://www.torrentday.com/",
|
||||
"https://td-update.com/",
|
||||
"https://www.torrentday.me/",
|
||||
"https://www.torrentday.ru/",
|
||||
"https://www.torrentday.com/",
|
||||
"https://www.td.af/",
|
||||
};
|
||||
|
||||
new ConfigurationDataRecaptchaLogin configData
|
||||
new ConfigurationDataRecaptchaLoginWithAlternateLink configData
|
||||
{
|
||||
get { return (ConfigurationDataRecaptchaLogin)base.configData; }
|
||||
get { return (ConfigurationDataRecaptchaLoginWithAlternateLink)base.configData; }
|
||||
set { base.configData = value; }
|
||||
}
|
||||
|
||||
|
@ -40,8 +54,11 @@ namespace Jackett.Indexers
|
|||
client: wc,
|
||||
logger: l,
|
||||
p: ps,
|
||||
configData: new ConfigurationDataRecaptchaLogin())
|
||||
configData: new ConfigurationDataRecaptchaLoginWithAlternateLink())
|
||||
{
|
||||
this.configData.Instructions.Value = this.DisplayName + " has multiple URLs. The default (" + this.SiteLink + ") can be changed by entering a new value in the box below.";
|
||||
this.configData.Instructions.Value += "The following are some known URLs for " + this.DisplayName;
|
||||
this.configData.Instructions.Value += "<ul><li>" + String.Join("</li><li>", this.KnownURLs.ToArray()) + "</li></ul>";
|
||||
|
||||
AddCategoryMapping(29, TorznabCatType.TVAnime);
|
||||
AddCategoryMapping(28, TorznabCatType.PC);
|
||||
|
@ -93,9 +110,10 @@ namespace Jackett.Indexers
|
|||
{
|
||||
var loginPage = await RequestStringWithCookies(StartPageUrl, string.Empty);
|
||||
CQ cq = loginPage.Content;
|
||||
var result = new ConfigurationDataRecaptchaLogin();
|
||||
var result = this.configData;
|
||||
result.CookieHeader.Value = loginPage.Cookies;
|
||||
result.Captcha.SiteKey = cq.Find(".g-recaptcha").Attr("data-sitekey");
|
||||
result.Captcha.Version = "2";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -131,7 +149,7 @@ namespace Jackett.Indexers
|
|||
}
|
||||
}
|
||||
|
||||
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, configData.CookieHeader.Value, true, SiteLink, LoginUrl);
|
||||
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, configData.CookieHeader.Value, true, UseLink, LoginUrl);
|
||||
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () =>
|
||||
{
|
||||
CQ dom = result.Content;
|
||||
|
@ -191,9 +209,9 @@ namespace Jackett.Indexers
|
|||
release.MinimumSeedTime = 172800;
|
||||
release.Title = qRow.Find(".torrentName").Text();
|
||||
release.Description = release.Title;
|
||||
release.Guid = new Uri(SiteLink + qRow.Find(".torrentName").Attr("href"));
|
||||
release.Guid = new Uri(UseLink + qRow.Find(".torrentName").Attr("href"));
|
||||
release.Comments = release.Guid;
|
||||
release.Link = new Uri(SiteLink + qRow.Find(".dlLinksInfo > a").Attr("href"));
|
||||
release.Link = new Uri(UseLink + qRow.Find(".dlLinksInfo > a").Attr("href"));
|
||||
|
||||
var sizeStr = qRow.Find(".sizeInfo").Text();
|
||||
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
||||
|
|
|
@ -217,6 +217,7 @@
|
|||
<Compile Include="Models\IndexerConfig\ConfigurationDataAPIKey.cs" />
|
||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginWithRSSAndDisplay.cs" />
|
||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginWithAlternateLink.cs" />
|
||||
<Compile Include="Models\IndexerConfig\ConfigurationDataRecaptchaLoginWithAlternateLink.cs" />
|
||||
<Compile Include="Models\ManualSearchResult.cs" />
|
||||
<Compile Include="Indexers\TVChaosUK.cs" />
|
||||
<Compile Include="Indexers\NCore.cs" />
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Models.IndexerConfig
|
||||
{
|
||||
public class ConfigurationDataRecaptchaLoginWithAlternateLink : ConfigurationData
|
||||
{
|
||||
public StringItem Username { get; private set; }
|
||||
public StringItem Password { get; private set; }
|
||||
public DisplayItem Instructions { get; private set; }
|
||||
public StringItem AlternateLink { get; set; }
|
||||
public RecaptchaItem Captcha { get; private set; }
|
||||
|
||||
public ConfigurationDataRecaptchaLoginWithAlternateLink(string instructionMessageOptional = null)
|
||||
{
|
||||
Username = new StringItem { Name = "Username" };
|
||||
Password = new StringItem { Name = "Password" };
|
||||
Instructions = new DisplayItem(instructionMessageOptional) { Name = "" };
|
||||
AlternateLink = new StringItem { Name = "Alternate Link" };
|
||||
Captcha = new RecaptchaItem() { Name = "Recaptcha" };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue