Fixed RevolutionTT so that login can use username/password (instead of cookie)

This commit is contained in:
some-guy-23 2015-12-21 18:18:07 -05:00
parent 226c27f903
commit e4a47927b9
1 changed files with 15 additions and 6 deletions

View File

@ -19,13 +19,14 @@ using Jackett.Models.IndexerConfig;
namespace Jackett.Indexers namespace Jackett.Indexers
{ {
public class RevolutionTT : BaseIndexer, IIndexer public class RevolutionTT : BaseIndexer, IIndexer
{ {
private string LandingPageURL { get { return SiteLink + "login.php"; } }
private string LoginUrl { get { return SiteLink + "takelogin.php"; } } private string LoginUrl { get { return SiteLink + "takelogin.php"; } }
private string SearchUrl { get { return SiteLink + "browse.php"; } } private string SearchUrl { get { return SiteLink + "browse.php"; } }
new ConfigurationDataCookie configData new ConfigurationDataBasicLogin configData
{ {
get { return (ConfigurationDataCookie)base.configData; } get { return (ConfigurationDataBasicLogin)base.configData; }
set { base.configData = value; } set { base.configData = value; }
} }
@ -39,7 +40,7 @@ namespace Jackett.Indexers
logger: l, logger: l,
p: ps, p: ps,
downloadBase: "https://revolutiontt.me/download.php/", downloadBase: "https://revolutiontt.me/download.php/",
configData: new ConfigurationDataCookie()) configData: new ConfigurationDataBasicLogin())
{ {
/* Original RevolutionTT Categories - /* Original RevolutionTT Categories -
@ -151,8 +152,16 @@ namespace Jackett.Indexers
{ {
configData.LoadValuesFromJson(configJson); configData.LoadValuesFromJson(configJson);
var result = await RequestStringWithCookies(SearchUrl, configData.Cookie.Value, null, null); var pairs = new Dictionary<string, string> {
await ConfigureIfOK(configData.Cookie.Value, result.Content != null && result.Content.Contains("/logout.php"), () => { "username", configData.Username.Value },
{ "password", configData.Password.Value }
};
//--need to do an initial request to get PHP session cookie (any better way to do this?)
var homePageLoad = await RequestLoginAndFollowRedirect(LandingPageURL, new Dictionary<string, string> { }, null, true, null, SiteLink);
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, homePageLoad.Cookies, true, null, LoginUrl);
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("/logout.php"), () =>
{ {
CQ dom = result.Content; CQ dom = result.Content;
var messageEl = dom[".error"]; var messageEl = dom[".error"];