2017-10-29 06:50:47 +00:00
|
|
|
|
using System;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Linq;
|
2017-11-05 09:42:03 +00:00
|
|
|
|
using System.Net;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
using System.Text;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
using System.Text.RegularExpressions;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2015-12-22 01:03:50 +00:00
|
|
|
|
using System.Xml.Linq;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
using CsQuery;
|
2018-03-10 08:05:56 +00:00
|
|
|
|
using Jackett.Common.Models;
|
|
|
|
|
using Jackett.Common.Models.IndexerConfig;
|
|
|
|
|
using Jackett.Common.Services.Interfaces;
|
|
|
|
|
using Jackett.Common.Utils;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using NLog;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
|
namespace Jackett.Common.Indexers
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2017-07-10 20:58:44 +00:00
|
|
|
|
public class RevolutionTT : BaseWebIndexer
|
2017-10-29 06:50:47 +00:00
|
|
|
|
{
|
2015-12-21 23:18:07 +00:00
|
|
|
|
private string LandingPageURL { get { return SiteLink + "login.php"; } }
|
2015-12-21 21:10:39 +00:00
|
|
|
|
private string LoginUrl { get { return SiteLink + "takelogin.php"; } }
|
2015-12-22 01:03:50 +00:00
|
|
|
|
private string GetRSSKeyUrl { get { return SiteLink + "getrss.php"; } }
|
|
|
|
|
private string RSSUrl { get { return SiteLink + "rss.php?feed=dl&passkey="; } }
|
2017-10-29 06:50:47 +00:00
|
|
|
|
private string SearchUrl { get { return SiteLink + "browse.php"; } }
|
2015-12-22 01:03:50 +00:00
|
|
|
|
private string DetailsURL { get { return SiteLink + "details.php?id={0}&hit=1"; } }
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2017-10-29 06:50:47 +00:00
|
|
|
|
private new ConfigurationDataBasicLoginWithRSS configData
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2015-12-22 01:03:50 +00:00
|
|
|
|
get { return (ConfigurationDataBasicLoginWithRSS)base.configData; }
|
2015-12-21 21:10:39 +00:00
|
|
|
|
set { base.configData = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-05 09:42:03 +00:00
|
|
|
|
public RevolutionTT(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps)
|
2015-12-21 21:10:39 +00:00
|
|
|
|
: base(name: "RevolutionTT",
|
|
|
|
|
description: "The Revolution has begun",
|
|
|
|
|
link: "https://revolutiontt.me/",
|
|
|
|
|
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
|
2017-07-10 20:58:44 +00:00
|
|
|
|
configService: configService,
|
2015-12-21 21:10:39 +00:00
|
|
|
|
client: wc,
|
|
|
|
|
logger: l,
|
|
|
|
|
p: ps,
|
|
|
|
|
downloadBase: "https://revolutiontt.me/download.php/",
|
2015-12-22 01:03:50 +00:00
|
|
|
|
configData: new ConfigurationDataBasicLoginWithRSS())
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2016-12-09 17:20:58 +00:00
|
|
|
|
Encoding = Encoding.GetEncoding("iso-8859-1");
|
|
|
|
|
Language = "en-us";
|
2017-01-27 15:57:32 +00:00
|
|
|
|
Type = "private";
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
|
|
|
|
/* Original RevolutionTT Categories -
|
2017-10-29 06:50:47 +00:00
|
|
|
|
|
2015-12-21 21:10:39 +00:00
|
|
|
|
Anime - 23
|
|
|
|
|
Appz/Misc - 22
|
|
|
|
|
Appz/PC-ISO - 1
|
|
|
|
|
E-Book - 36
|
|
|
|
|
Games/PC-ISO - 4
|
|
|
|
|
Games/PC-Rips - 21
|
|
|
|
|
Games/PS3 - 16
|
|
|
|
|
Games/Wii - 40
|
|
|
|
|
Games/XBOX360 - 39
|
|
|
|
|
Handheld/NDS - 35
|
|
|
|
|
Handheld/PSP - 34
|
|
|
|
|
Mac - 2
|
|
|
|
|
Movies/BluRay - 10
|
|
|
|
|
Movies/DVDR - 20
|
|
|
|
|
Movies/HDx264 - 12
|
|
|
|
|
Movies/Packs - 44
|
|
|
|
|
Movies/SDx264 - 11
|
|
|
|
|
Movies/XviD - 19
|
|
|
|
|
Music - 6
|
|
|
|
|
Music/FLAC - 8
|
|
|
|
|
Music/Packs - 46
|
|
|
|
|
MusicVideos - 29
|
|
|
|
|
TV/DVDR - 43
|
|
|
|
|
TV/HDx264 - 42
|
|
|
|
|
TV/Packs - 45
|
|
|
|
|
TV/SDx264 - 41
|
2017-10-29 06:50:47 +00:00
|
|
|
|
TV/XViD - 7
|
|
|
|
|
|
2015-12-21 21:10:39 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.Console);
|
|
|
|
|
AddCategoryMapping("35", TorznabCatType.ConsoleNDS);
|
|
|
|
|
AddCategoryMapping("34", TorznabCatType.ConsolePSP);
|
|
|
|
|
AddCategoryMapping("40", TorznabCatType.ConsoleWii);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsoleXbox);
|
|
|
|
|
AddCategoryMapping("39", TorznabCatType.ConsoleXbox360);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsoleWiiwareVC);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsoleXBOX360DLC);
|
|
|
|
|
AddCategoryMapping("16", TorznabCatType.ConsolePS3);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsoleOther);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.Console3DS);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsolePSVita);
|
|
|
|
|
AddCategoryMapping("40", TorznabCatType.ConsoleWiiU);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsoleXboxOne);
|
2017-10-29 06:50:47 +00:00
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.ConsolePS4);
|
2015-12-21 21:10:39 +00:00
|
|
|
|
AddCategoryMapping("44", TorznabCatType.Movies);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.MoviesForeign);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.MoviesOther);
|
|
|
|
|
//Movies/DVDR, Movies/SDx264, Movies/XviD
|
|
|
|
|
AddMultiCategoryMapping(TorznabCatType.MoviesSD, 20, 11, 19);
|
|
|
|
|
//Movies/BluRay, Movies/HDx264
|
|
|
|
|
AddMultiCategoryMapping(TorznabCatType.MoviesHD, 10, 12);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.Movies3D);
|
|
|
|
|
AddCategoryMapping("10", TorznabCatType.MoviesBluRay);
|
|
|
|
|
AddCategoryMapping("20", TorznabCatType.MoviesDVD);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.MoviesWEBDL);
|
|
|
|
|
//Music, Music/Packs
|
|
|
|
|
AddMultiCategoryMapping(TorznabCatType.Audio, 6, 46);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.AudioMP3);
|
|
|
|
|
AddCategoryMapping("29", TorznabCatType.AudioVideo);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.AudioAudiobook);
|
|
|
|
|
AddCategoryMapping("8", TorznabCatType.AudioLossless);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.AudioOther);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.AudioForeign);
|
|
|
|
|
AddCategoryMapping("21", TorznabCatType.PC);
|
|
|
|
|
AddCategoryMapping("22", TorznabCatType.PC0day);
|
2018-06-02 23:11:42 +00:00
|
|
|
|
AddCategoryMapping("1", TorznabCatType.PCISO);
|
2015-12-21 21:10:39 +00:00
|
|
|
|
AddCategoryMapping("2", TorznabCatType.PCMac);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.PCPhoneOther);
|
|
|
|
|
//Games/PC-ISO, Games/PC-Rips
|
|
|
|
|
AddMultiCategoryMapping(TorznabCatType.PCGames, 4, 21);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.PCPhoneIOS);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.PCPhoneAndroid);
|
|
|
|
|
AddCategoryMapping("45", TorznabCatType.TV);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.TVWEBDL);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.TVFOREIGN);
|
|
|
|
|
//TV/DVDR, TV/SDx264, TV/XViD
|
|
|
|
|
AddMultiCategoryMapping(TorznabCatType.TVSD, 43, 41, 7);
|
|
|
|
|
AddCategoryMapping("42", TorznabCatType.TVHD);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.TVOTHER);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.TVSport);
|
|
|
|
|
AddCategoryMapping("23", TorznabCatType.TVAnime);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.TVDocumentary);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXX);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXDVD);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXWMV);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXXviD);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXx264);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXOther);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXImageset);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.XXXPacks);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.Other);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.OtherMisc);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.OtherHashed);
|
|
|
|
|
AddCategoryMapping("36", TorznabCatType.Books);
|
|
|
|
|
AddCategoryMapping("36", TorznabCatType.BooksEbook);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.BooksComics);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.BooksMagazines);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.BooksTechnical);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.BooksOther);
|
|
|
|
|
//AddCategoryMapping("cat_id", TorznabCatType.BooksForeign);
|
2015-12-22 01:03:50 +00:00
|
|
|
|
|
|
|
|
|
// RSS Textual categories
|
|
|
|
|
AddCategoryMapping("Anime", TorznabCatType.TVAnime);
|
|
|
|
|
AddCategoryMapping("Appz/Misc", TorznabCatType.PC0day);
|
2018-06-02 23:11:42 +00:00
|
|
|
|
AddCategoryMapping("Appz/PC-ISO", TorznabCatType.PCISO);
|
2015-12-22 01:03:50 +00:00
|
|
|
|
AddCategoryMapping("E-Book", TorznabCatType.BooksEbook);
|
|
|
|
|
AddCategoryMapping("Games/PC-ISO", TorznabCatType.PCGames);
|
|
|
|
|
AddCategoryMapping("Games/PC-Rips", TorznabCatType.PCGames);
|
|
|
|
|
AddCategoryMapping("Games/PS3", TorznabCatType.ConsolePS3);
|
|
|
|
|
AddCategoryMapping("Games/Wii", TorznabCatType.ConsoleWii);
|
|
|
|
|
AddCategoryMapping("Games/XBOX360", TorznabCatType.ConsoleXbox360);
|
|
|
|
|
AddCategoryMapping("Handheld/NDS", TorznabCatType.ConsoleNDS);
|
|
|
|
|
AddCategoryMapping("Handheld/PSP", TorznabCatType.ConsolePSP);
|
|
|
|
|
AddCategoryMapping("Mac", TorznabCatType.PCMac);
|
|
|
|
|
AddCategoryMapping("Movies/BluRay", TorznabCatType.MoviesBluRay);
|
|
|
|
|
AddCategoryMapping("Movies/DVDR", TorznabCatType.MoviesDVD);
|
|
|
|
|
AddCategoryMapping("Movies/HDx264", TorznabCatType.MoviesHD);
|
|
|
|
|
AddCategoryMapping("Movies/Packs", TorznabCatType.Movies);
|
|
|
|
|
AddCategoryMapping("Movies/SDx264", TorznabCatType.MoviesSD);
|
|
|
|
|
AddCategoryMapping("Movies/XviD", TorznabCatType.MoviesSD);
|
|
|
|
|
AddCategoryMapping("Music", TorznabCatType.Audio);
|
|
|
|
|
AddCategoryMapping("Music/FLAC", TorznabCatType.AudioLossless);
|
|
|
|
|
AddCategoryMapping("Music/Packs", TorznabCatType.AudioOther);
|
|
|
|
|
AddCategoryMapping("MusicVideos", TorznabCatType.AudioVideo);
|
|
|
|
|
AddCategoryMapping("TV/DVDR", TorznabCatType.TV);
|
|
|
|
|
AddCategoryMapping("TV/HDx264", TorznabCatType.TVHD);
|
|
|
|
|
AddCategoryMapping("TV/Packs", TorznabCatType.TV);
|
|
|
|
|
AddCategoryMapping("TV/SDx264", TorznabCatType.TVSD);
|
|
|
|
|
AddCategoryMapping("TV/XViD", TorznabCatType.TVSD);
|
2015-12-21 21:10:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-28 05:31:38 +00:00
|
|
|
|
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2017-01-02 20:39:28 +00:00
|
|
|
|
LoadValuesFromJson(configJson);
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-21 23:18:07 +00:00
|
|
|
|
var pairs = new Dictionary<string, string> {
|
|
|
|
|
{ "username", configData.Username.Value },
|
|
|
|
|
{ "password", configData.Password.Value }
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
// need to do an initial request to get PHP session cookie (any better way to do this?)
|
2015-12-21 23:18:07 +00:00
|
|
|
|
var homePageLoad = await RequestLoginAndFollowRedirect(LandingPageURL, new Dictionary<string, string> { }, null, true, null, SiteLink);
|
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, homePageLoad.Cookies, true, null, LandingPageURL);
|
2015-12-21 23:18:07 +00:00
|
|
|
|
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("/logout.php"), () =>
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
|
|
|
|
CQ dom = result.Content;
|
|
|
|
|
var messageEl = dom[".error"];
|
|
|
|
|
var errorMessage = messageEl.Text().Trim();
|
|
|
|
|
throw new ExceptionWithConfigData(errorMessage, configData);
|
|
|
|
|
});
|
2015-12-22 01:03:50 +00:00
|
|
|
|
|
|
|
|
|
// Store RSS key from feed generator page
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var rssParams = new Dictionary<string, string> {
|
|
|
|
|
{ "feed", "dl" }
|
|
|
|
|
};
|
|
|
|
|
var rssPage = await PostDataWithCookies(GetRSSKeyUrl, rssParams, result.Cookies);
|
|
|
|
|
var match = Regex.Match(rssPage.Content, "(?<=passkey\\=)([a-zA-z0-9]*)");
|
|
|
|
|
configData.RSSKey.Value = match.Success ? match.Value : string.Empty;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(configData.RSSKey.Value))
|
|
|
|
|
throw new Exception("Failed to get RSS Key");
|
|
|
|
|
SaveConfig();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
IsConfigured = false;
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-21 21:10:39 +00:00
|
|
|
|
return IndexerConfigurationStatus.RequiresTesting;
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-03 05:15:47 +00:00
|
|
|
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
|
|
|
|
var releases = new List<ReleaseInfo>();
|
|
|
|
|
var searchString = query.GetQueryString();
|
|
|
|
|
var searchUrl = SearchUrl;
|
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
// If query is empty, use the RSS Feed
|
|
|
|
|
if (string.IsNullOrWhiteSpace(searchString))
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var rssPage = await RequestStringWithCookiesAndRetry(RSSUrl + configData.RSSKey.Value);
|
|
|
|
|
var rssDoc = XDocument.Parse(rssPage.Content);
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
foreach (var item in rssDoc.Descendants("item"))
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var title = item.Descendants("title").First().Value;
|
2017-07-08 11:54:37 +00:00
|
|
|
|
if (title.StartsWith("Support YOUR site!"))
|
|
|
|
|
continue;
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var description = item.Descendants("description").First().Value;
|
|
|
|
|
var link = item.Descendants("link").First().Value;
|
|
|
|
|
var date = item.Descendants("pubDate").First().Value;
|
|
|
|
|
|
|
|
|
|
var torrentIdMatch = Regex.Match(link, "(?<=download\\.php/)([a-zA-z0-9]*)");
|
|
|
|
|
var torrentId = torrentIdMatch.Success ? torrentIdMatch.Value : string.Empty;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(torrentId))
|
|
|
|
|
throw new Exception("Missing torrent id");
|
|
|
|
|
|
|
|
|
|
var infoMatch = Regex.Match(description, @"Category:\W(?<cat>.*)\W\n\WSize:\W(?<size>.*)\n\WStatus:\W(?<seeders>.*)\Wseeder(.*)\Wand\W(?<leechers>.*)\Wleecher(.*)\n\WAdded:\W(?<added>.*)\n\WDescription:");
|
|
|
|
|
if (!infoMatch.Success)
|
|
|
|
|
throw new Exception("Unable to find info");
|
|
|
|
|
|
|
|
|
|
var imdbMatch = Regex.Match(description, "(?<=http://www.imdb.com/title/tt)([0-9]*)");
|
|
|
|
|
long? imdbID = null;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
if (imdbMatch.Success)
|
2015-12-22 01:03:50 +00:00
|
|
|
|
{
|
|
|
|
|
long l;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
if (long.TryParse(imdbMatch.Value, out l))
|
2015-12-22 01:03:50 +00:00
|
|
|
|
{
|
|
|
|
|
imdbID = l;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-20 08:10:30 +00:00
|
|
|
|
var Now = DateTime.Now;
|
|
|
|
|
var PublishDate = DateTime.ParseExact(date, "ddd, dd MMM yyyy HH:mm:ss zz00", CultureInfo.InvariantCulture);
|
|
|
|
|
var PublishDateLocal = PublishDate.ToLocalTime();
|
|
|
|
|
var diff = Now - PublishDateLocal;
|
2015-12-22 01:03:50 +00:00
|
|
|
|
|
|
|
|
|
var release = new ReleaseInfo()
|
|
|
|
|
{
|
|
|
|
|
Title = title,
|
|
|
|
|
Description = title,
|
|
|
|
|
Guid = new Uri(string.Format(DetailsURL, torrentId)),
|
2018-01-02 20:05:26 +00:00
|
|
|
|
Comments = new Uri(string.Format(DetailsURL, torrentId)),
|
2018-05-15 10:46:57 +00:00
|
|
|
|
//PublishDate = DateTime.ParseExact(infoMatch.Groups["added"].Value, "yyyy-MM-dd H:mm:ss", CultureInfo.InvariantCulture), //2015-08-08 21:20:31 TODO: correct timezone (always -4)
|
2018-05-20 08:10:30 +00:00
|
|
|
|
PublishDate = PublishDateLocal,
|
2015-12-22 01:03:50 +00:00
|
|
|
|
Link = new Uri(link),
|
|
|
|
|
Seeders = ParseUtil.CoerceInt(infoMatch.Groups["seeders"].Value == "no" ? "0" : infoMatch.Groups["seeders"].Value),
|
|
|
|
|
Peers = ParseUtil.CoerceInt(infoMatch.Groups["leechers"].Value == "no" ? "0" : infoMatch.Groups["leechers"].Value),
|
|
|
|
|
Size = ReleaseInfo.GetBytes(infoMatch.Groups["size"].Value),
|
|
|
|
|
Category = MapTrackerCatToNewznab(infoMatch.Groups["cat"].Value),
|
|
|
|
|
Imdb = imdbID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// if unknown category, set to "other"
|
2017-02-21 12:07:54 +00:00
|
|
|
|
if (release.Category.Count() == 0)
|
|
|
|
|
release.Category.Add(7000);
|
2015-12-22 01:03:50 +00:00
|
|
|
|
|
|
|
|
|
release.Peers += release.Seeders;
|
|
|
|
|
releases.Add(release);
|
2015-12-21 21:10:39 +00:00
|
|
|
|
}
|
2015-12-22 01:03:50 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2017-11-05 09:42:03 +00:00
|
|
|
|
searchUrl += "?titleonly=1&search=" + WebUtility.UrlEncode(searchString);
|
|
|
|
|
string.Format(SearchUrl, WebUtility.UrlEncode(searchString));
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var cats = MapTorznabCapsToTrackers(query);
|
|
|
|
|
if (cats.Count > 0)
|
2015-12-21 21:10:39 +00:00
|
|
|
|
{
|
2015-12-22 01:03:50 +00:00
|
|
|
|
foreach (var cat in cats)
|
|
|
|
|
{
|
|
|
|
|
searchUrl += "&c" + cat + "=1";
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var results = await RequestStringWithCookiesAndRetry(searchUrl);
|
2018-08-25 16:32:10 +00:00
|
|
|
|
if (results.IsRedirect)
|
|
|
|
|
{
|
|
|
|
|
// re-login
|
|
|
|
|
await ApplyConfiguration(null);
|
|
|
|
|
results = await RequestStringWithCookiesAndRetry(searchUrl);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CQ dom = results.Content;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
// table header is the first <tr> in table body, get all rows except this
|
|
|
|
|
CQ qRows = dom["#torrents-table > tbody > tr:not(:first-child)"];
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
foreach (var row in qRows)
|
|
|
|
|
{
|
|
|
|
|
var release = new ReleaseInfo();
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var qRow = row.Cq();
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
var debug = qRow.Html();
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
release.MinimumRatio = 1;
|
|
|
|
|
release.MinimumSeedTime = 172800;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2015-12-22 01:03:50 +00:00
|
|
|
|
CQ qLink = qRow.Find(".br_right > a").First();
|
|
|
|
|
release.Guid = new Uri(SiteLink + qLink.Attr("href"));
|
|
|
|
|
release.Comments = new Uri(SiteLink + qLink.Attr("href") + "&tocomm=1");
|
|
|
|
|
release.Title = qLink.Find("b").Text();
|
|
|
|
|
release.Description = release.Title;
|
2015-12-21 21:10:39 +00:00
|
|
|
|
|
2017-06-23 17:56:03 +00:00
|
|
|
|
var releaseLinkURI = qRow.Find("td:nth-child(4) > a").Attr("href");
|
|
|
|
|
release.Link = new Uri(SiteLink + releaseLinkURI);
|
2017-10-29 06:50:47 +00:00
|
|
|
|
if (releaseLinkURI != null)
|
|
|
|
|
{
|
2017-06-23 17:56:03 +00:00
|
|
|
|
var dateString = qRow.Find("td:nth-child(6) nobr")[0].TextContent.Trim();
|
|
|
|
|
//"2015-04-25 23:38:12"
|
|
|
|
|
//"yyyy-MMM-dd hh:mm:ss"
|
|
|
|
|
release.PublishDate = DateTime.ParseExact(dateString, "yyyy-MM-ddHH:mm:ss", CultureInfo.InvariantCulture);
|
|
|
|
|
|
|
|
|
|
var sizeStr = qRow.Children().ElementAt(6).InnerHTML.Trim();
|
|
|
|
|
sizeStr = sizeStr.Substring(0, sizeStr.IndexOf('<'));
|
|
|
|
|
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
|
|
|
|
|
|
|
|
|
release.Seeders = ParseUtil.CoerceInt(qRow.Find("td:nth-child(9)").Text());
|
|
|
|
|
release.Peers = release.Seeders + ParseUtil.CoerceInt(qRow.Find("td:nth-child(10)").Text());
|
|
|
|
|
|
2018-06-02 23:11:42 +00:00
|
|
|
|
var grabsStr = qRow.Find("td:nth-child(8)").Text();
|
|
|
|
|
release.Grabs = ParseUtil.GetLongFromString(grabsStr);
|
|
|
|
|
|
2018-06-11 15:36:29 +00:00
|
|
|
|
var filesStr = qRow.Find("td:nth-child(7) > a").Text();
|
|
|
|
|
release.Files = ParseUtil.GetLongFromString(filesStr);
|
|
|
|
|
|
2017-06-23 17:56:03 +00:00
|
|
|
|
var category = qRow.Find(".br_type > a").Attr("href").Replace("browse.php?cat=", string.Empty);
|
|
|
|
|
release.Category = MapTrackerCatToNewznab(category);
|
|
|
|
|
}
|
2015-12-22 01:03:50 +00:00
|
|
|
|
releases.Add(release);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
OnParseError(results.Content, ex);
|
|
|
|
|
}
|
2015-12-21 21:10:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return releases;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-02 23:11:42 +00:00
|
|
|
|
}
|