From e3f15b92b848ce760d65bf0fcee955d4720d9f1f Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Sun, 17 Apr 2022 08:53:56 +0200 Subject: [PATCH] erai-raws: make it semi-private and add rss key. closes #4116 (#13170) --- README.md | 2 +- src/Jackett.Common/Indexers/EraiRaws.cs | 24 ++++++++----------- .../Common/Indexers/EraiRawsTests.cs | 2 -- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f92f9500d..681ae681a 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,6 @@ A third-party Golang SDK for Jackett is available from [webtor-io/go-jackett](ht * E-Hentai * elitetorrent * EpubLibre - * Erai-Raws * EXT Torrents * ExtraTorrent.st * EZTV @@ -189,6 +188,7 @@ A third-party Golang SDK for Jackett is available from [webtor-io/go-jackett](ht * DimeADozen (EzTorrent) * DXP (Deaf Experts) * EniaHD + * Erai-Raws * ExKinoRay * ExtremlymTorrents * Fenyarnyek-Tracker diff --git a/src/Jackett.Common/Indexers/EraiRaws.cs b/src/Jackett.Common/Indexers/EraiRaws.cs index 30a1b0e9c..beb9141fb 100644 --- a/src/Jackett.Common/Indexers/EraiRaws.cs +++ b/src/Jackett.Common/Indexers/EraiRaws.cs @@ -52,7 +52,11 @@ namespace Jackett.Common.Indexers { Encoding = Encoding.UTF8; Language = "en-US"; - Type = "public"; + Type = "semi-private"; + + var rssKey = new StringConfigurationItem("RSSKey") { Value = "" }; + configData.AddDynamic("rssKey", rssKey); + configData.AddDynamic("rssKeyHelp", new DisplayInfoConfigurationItem(string.Empty, "Find the RSS Key by accessing Erai-Raws RSS page while you're logged in. Copy the All RSS URL, the RSS Key is the last part. Example: for the URL .../feed/?type=torrent&0879fd62733b8db8535eb1be2333 the RSS Key is 0879fd62733b8db8535eb1be2333")); configData.AddDynamic( "DDoS-Guard", @@ -61,7 +65,7 @@ namespace Jackett.Common.Indexers // Add note that download stats are not available configData.AddDynamic( "download-stats-unavailable", - new DisplayInfoConfigurationItem("", "

Please note that the following stats are not available for this indexer. Default values are used instead.

") + new DisplayInfoConfigurationItem("", "

Please note that the following stats are not available for this indexer. Default values are used instead.

") ); // Config item for title detail parsing @@ -77,15 +81,10 @@ namespace Jackett.Common.Indexers private TitleParser titleParser = new TitleParser(); + private string RSSKey => ((StringConfigurationItem)configData.GetDynamic("rssKey")).Value; private bool IsTitleDetailParsingEnabled => ((BoolConfigurationItem)configData.GetDynamic("title-detail-parsing")).Value; - public string RssFeedUri - { - get - { - return string.Concat(SiteLink, RSS_PATH); - } - } + public string RssFeedUri => SiteLink + RSS_PATH + "&" + RSSKey; public override async Task ApplyConfiguration(JToken configJson) { @@ -213,6 +212,7 @@ namespace Jackett.Common.Indexers // Download stats are not available through scraping so set some mock values. Size = fi.Size, + Files = 1, Seeders = 1, Peers = 2, DownloadVolumeFactor = 0, @@ -309,19 +309,15 @@ namespace Jackett.Common.Indexers InfoHash = feedItem.InfoHash; if (Uri.TryCreate(feedItem.Link, UriKind.Absolute, out Uri magnetUri)) - { MagnetLink = magnetUri; - } if (DateTimeOffset.TryParse(feedItem.PublishDate, out DateTimeOffset publishDate)) - { PublishDate = publishDate; - } } private string StripTitle(string rawTitle) { - var prefixStripped = Regex.Replace(rawTitle, "^\\[.+?\\] ", ""); + var prefixStripped = Regex.Replace(rawTitle, "^\\[.+?\\]", ""); var suffixStripped = Regex.Replace(prefixStripped, " \\[.+\\]", ""); return suffixStripped.Trim(); } diff --git a/src/Jackett.Test/Common/Indexers/EraiRawsTests.cs b/src/Jackett.Test/Common/Indexers/EraiRawsTests.cs index 9b274d5b0..a24babd8e 100644 --- a/src/Jackett.Test/Common/Indexers/EraiRawsTests.cs +++ b/src/Jackett.Test/Common/Indexers/EraiRawsTests.cs @@ -1,8 +1,6 @@ -using System; using System.Collections; using Jackett.Common.Indexers; using NUnit.Framework; -using Assert = NUnit.Framework.Assert; namespace Jackett.Test.Common.Indexers {