diff --git a/src/Jackett.Common/Definitions/pier720.yml b/src/Jackett.Common/Definitions/pier720.yml new file mode 100644 index 000000000..8236916cd --- /dev/null +++ b/src/Jackett.Common/Definitions/pier720.yml @@ -0,0 +1,177 @@ +--- +id: pier720 +name: 720pier +description: "720pier is a RUSSIAN Private Torrent Tracker for HD SPORTS" +language: ru-ru +type: private +encoding: UTF-8 +links: + - https://720pier.ru/ +legacylinks: + - http://720pier.ru/ + +caps: + categorymappings: + - {id: 32, cat: TV/Sport, desc: "Basketball"} + - {id: 34, cat: TV/Sport, desc: "Basketball - NBA"} + - {id: 87, cat: TV/Sport, desc: "Basketball - NBA Playoffs"} + - {id: 81, cat: TV/Sport, desc: "Basketball - NBA Playoffs - 2016"} + - {id: 95, cat: TV/Sport, desc: "Basketball - NBA Playoffs - 2017"} + - {id: 58, cat: TV/Sport, desc: "Basketball - NBA (до 2015 г.)"} + - {id: 52, cat: TV/Sport, desc: "Basketball - NCAA"} + - {id: 82, cat: TV/Sport, desc: "Basketball - WNBA"} + - {id: 36, cat: TV/Sport, desc: "Basketball - European basketball"} + - {id: 37, cat: TV/Sport, desc: "Basketball - World Championship"} + - {id: 51, cat: TV/Sport, desc: "Basketball - Reviews and highlights"} + - {id: 41, cat: TV/Sport, desc: "Basketball - Other"} + - {id: 38, cat: TV/Sport, desc: "Basketball - Olympic Games"} + - {id: 42, cat: TV/Sport, desc: "Football"} + - {id: 43, cat: TV/Sport, desc: "Football - NFL"} + - {id: 66, cat: TV/Sport, desc: "Football - Super Bowls"} + - {id: 53, cat: TV/Sport, desc: "Football - NCAA"} + - {id: 99, cat: TV/Sport, desc: "Football - CFL"} + - {id: 101, cat: TV/Sport, desc: "Football - AAF"} + - {id: 54, cat: TV/Sport, desc: "Football - Reviews and highlights"} + - {id: 97, cat: TV/Sport, desc: "Football - Documentaries"} + - {id: 44, cat: TV/Sport, desc: "Football - Other"} + - {id: 46, cat: TV/Sport, desc: "Hockey"} + - {id: 48, cat: TV/Sport, desc: "Hockey - NHL"} + - {id: 88, cat: TV/Sport, desc: "Hockey - NHL Playoffs"} + - {id: 93, cat: TV/Sport, desc: "Hockey - NHL Playoffs - 2017"} + - {id: 80, cat: TV/Sport, desc: "Hockey - NHL Playoffs - 2016"} + - {id: 65, cat: TV/Sport, desc: "Hockey - Stanley Cup Finals"} + - {id: 69, cat: TV/Sport, desc: "Hockey - Stanley Cup Finals - 2005-2014"} + - {id: 70, cat: TV/Sport, desc: "Hockey - Stanley Cup Finals - 2003"} + - {id: 92, cat: TV/Sport, desc: "Hockey - NCAA"} + - {id: 49, cat: TV/Sport, desc: "Hockey - World Championship"} + - {id: 68, cat: TV/Sport, desc: "Hockey - Documentaries"} + - {id: 64, cat: TV/Sport, desc: "Hockey - Reviews and highlights"} + - {id: 50, cat: TV/Sport, desc: "Hockey - Other"} + - {id: 55, cat: TV/Sport, desc: "Baseball"} + - {id: 71, cat: TV/Sport, desc: "Baseball - MLB"} + - {id: 72, cat: TV/Sport, desc: "Baseball - Other"} + - {id: 85, cat: TV/Sport, desc: "Baseball - Reviews, highlights, documentaries"} + - {id: 59, cat: TV/Sport, desc: "Soccer"} + - {id: 61, cat: TV/Sport, desc: "Soccer - English soccer"} + - {id: 86, cat: TV/Sport, desc: "Soccer - UEFA"} + - {id: 100, cat: TV/Sport, desc: "Soccer - MLS"} + - {id: 62, cat: TV/Sport, desc: "Soccer - Other tournaments, championships"} + - {id: 63, cat: TV/Sport, desc: "Soccer - World Championships"} + - {id: 98, cat: TV/Sport, desc: "Soccer - FIFA World Cup"} + - {id: 45, cat: TV/Sport, desc: "Other sports"} + - {id: 79, cat: TV/Sport, desc: "Other sports - Rugby"} + - {id: 78, cat: TV/Sport, desc: "Other sports - Lacrosse"} + - {id: 77, cat: TV/Sport, desc: "Other sports - Cricket"} + - {id: 76, cat: TV/Sport, desc: "Other sports - Volleyball"} + - {id: 75, cat: TV/Sport, desc: "Other sports - Tennis"} + - {id: 74, cat: TV/Sport, desc: "Other sports - Fighting"} + - {id: 73, cat: TV/Sport, desc: "Other sports - Auto, moto racing"} + - {id: 91, cat: TV/Sport, desc: "Other sports - Olympic Games"} + - {id: 94, cat: TV/Sport, desc: "Other sports - Misc"} + - {id: 56, cat: TV/Sport, desc: "Sports on tv"} + - {id: 30, cat: TV/Sport, desc: "Sports"} + + modes: + search: [q] + tv-search: [q] + +settings: + - name: username + type: text + label: Username + - name: password + type: password + label: Password + - name: sort + type: select + label: Sort requested from site + default: "t" + options: + "t": "created" + "ts": "seeders" + "sz": "size" + "i": "title" + - name: type + type: select + label: Order requested from site + default: "d" + options: + "d": "desc" + "a": "asc" + +login: + path: ucp.php?mode=login + method: form + form: form#login + inputs: + username: "{{ .Config.username }}" + password: "{{ .Config.password }}" + autologin: on + viewonline: on + error: + - selector: fieldset:has(div.error) + test: + path: / + selector: :has(a[href^="./ucp.php?mode=logout&"]) + +download: + selector: a[href*="/download/torrent?id="] + attribute: href + +search: + paths: + - path: search.php + inputs: + keywords: "{{ if .Keywords }}{{ .Keywords }}{{ else }}{{ .Today.Year }}{{ end }}" + terms: all + author: "" + sc: 1 + sf: firstpost + sr: topics + sk: "{{ .Config.sort }}" + sd: "{{ .Config.type }}" + st: 0 + ch: 300 + t: 0 + submit: Search + + rows: + selector: li.row + + fields: + title: + selector: a.topictitle + details: + selector: a.topictitle + attribute: href + category: + selector: a[href^="./viewforum.php?f="] + attribute: href + filters: + - name: querystring + args: f + download: + selector: a.topictitle + attribute: href + size: + selector: div.list-inner div[style="float:right;"] + seeders: + selector: dd.posts span.my_tt.seed + optional: true + leechers: + selector: dd.posts span.my_tt.leech + optional: true + grabs: + selector: dd.views span.my_tt.complet + date: + selector: div.left-box time + downloadvolumefactor: + text: 1 + uploadvolumefactor: + text: 1 + minimumratio: + text: 0.8 + minimumseedtime: + # 60 hours (as seconds = 60 x 60 x 60) + text: 216000 +# phpBB diff --git a/src/Jackett.Common/Indexers/Pier720.cs b/src/Jackett.Common/Indexers/Pier720.cs deleted file mode 100644 index 8c4d43ead..000000000 --- a/src/Jackett.Common/Indexers/Pier720.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Diagnostics.CodeAnalysis; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using AngleSharp.Html.Parser; -using Jackett.Common.Models; -using Jackett.Common.Models.IndexerConfig; -using Jackett.Common.Services.Interfaces; -using Jackett.Common.Utils; -using Jackett.Common.Utils.Clients; -using Newtonsoft.Json.Linq; -using NLog; - -namespace Jackett.Common.Indexers -{ - [ExcludeFromCodeCoverage] - public class Pier720 : BaseWebIndexer - { - public Pier720(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) : - base(id: "pier720", - name: "720pier", - description: "720pier is a RUSSIAN Private Torrent Tracker for HD SPORTS", - link: "https://720pier.ru/", - caps: TorznabUtil.CreateDefaultTorznabTVCaps(), - configService: configService, - client: wc, - logger: l, - p: ps, - configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) - { - Encoding = Encoding.UTF8; - Language = "ru-ru"; - Type = "private"; - - AddCategoryMapping(32, TorznabCatType.TVSport, "Basketball"); - AddCategoryMapping(34, TorznabCatType.TVSport, "Basketball - NBA"); - AddCategoryMapping(87, TorznabCatType.TVSport, "Basketball - NBA Playoffs"); - AddCategoryMapping(81, TorznabCatType.TVSport, "Basketball - NBA Playoffs - 2016"); - AddCategoryMapping(95, TorznabCatType.TVSport, "Basketball - NBA Playoffs - 2017"); - AddCategoryMapping(58, TorznabCatType.TVSport, "Basketball - NBA (до 2015 г.)"); - AddCategoryMapping(52, TorznabCatType.TVSport, "Basketball - NCAA"); - AddCategoryMapping(82, TorznabCatType.TVSport, "Basketball - WNBA"); - AddCategoryMapping(36, TorznabCatType.TVSport, "Basketball - European basketball"); - AddCategoryMapping(37, TorznabCatType.TVSport, "Basketball - World Championship"); - AddCategoryMapping(51, TorznabCatType.TVSport, "Basketball - Reviews and highlights"); - AddCategoryMapping(41, TorznabCatType.TVSport, "Basketball - Other"); - AddCategoryMapping(38, TorznabCatType.TVSport, "Basketball - Olympic Games"); - AddCategoryMapping(42, TorznabCatType.TVSport, "Football"); - AddCategoryMapping(43, TorznabCatType.TVSport, "Football - NFL"); - AddCategoryMapping(66, TorznabCatType.TVSport, "Football - Super Bowls"); - AddCategoryMapping(53, TorznabCatType.TVSport, "Football - NCAA"); - AddCategoryMapping(99, TorznabCatType.TVSport, "Football - CFL"); - AddCategoryMapping(101, TorznabCatType.TVSport, "Football - AAF"); - AddCategoryMapping(54, TorznabCatType.TVSport, "Football - Reviews and highlights"); - AddCategoryMapping(97, TorznabCatType.TVSport, "Football - Documentaries"); - AddCategoryMapping(44, TorznabCatType.TVSport, "Football - Other"); - AddCategoryMapping(46, TorznabCatType.TVSport, "Hockey"); - AddCategoryMapping(48, TorznabCatType.TVSport, "Hockey - NHL"); - AddCategoryMapping(88, TorznabCatType.TVSport, "Hockey - NHL Playoffs"); - AddCategoryMapping(93, TorznabCatType.TVSport, "Hockey - NHL Playoffs - 2017"); - AddCategoryMapping(80, TorznabCatType.TVSport, "Hockey - NHL Playoffs - 2016"); - AddCategoryMapping(65, TorznabCatType.TVSport, "Hockey - Stanley Cup Finals"); - AddCategoryMapping(69, TorznabCatType.TVSport, "Hockey - Stanley Cup Finals - 2005-2014"); - AddCategoryMapping(70, TorznabCatType.TVSport, "Hockey - Stanley Cup Finals - 2003"); - AddCategoryMapping(92, TorznabCatType.TVSport, "Hockey - NCAA"); - AddCategoryMapping(49, TorznabCatType.TVSport, "Hockey - World Championship"); - AddCategoryMapping(68, TorznabCatType.TVSport, "Hockey - Documentaries"); - AddCategoryMapping(64, TorznabCatType.TVSport, "Hockey - Reviews and highlights"); - AddCategoryMapping(50, TorznabCatType.TVSport, "Hockey - Other"); - AddCategoryMapping(55, TorznabCatType.TVSport, "Baseball"); - AddCategoryMapping(71, TorznabCatType.TVSport, "Baseball - MLB"); - AddCategoryMapping(72, TorznabCatType.TVSport, "Baseball - Other"); - AddCategoryMapping(85, TorznabCatType.TVSport, "Baseball - Reviews, highlights, documentaries"); - AddCategoryMapping(59, TorznabCatType.TVSport, "Soccer"); - AddCategoryMapping(61, TorznabCatType.TVSport, "Soccer - English soccer"); - AddCategoryMapping(86, TorznabCatType.TVSport, "Soccer - UEFA"); - AddCategoryMapping(100, TorznabCatType.TVSport, "Soccer - MLS"); - AddCategoryMapping(62, TorznabCatType.TVSport, "Soccer - Other tournaments, championships"); - AddCategoryMapping(63, TorznabCatType.TVSport, "Soccer - World Championships"); - AddCategoryMapping(98, TorznabCatType.TVSport, "Soccer - FIFA World Cup"); - AddCategoryMapping(45, TorznabCatType.TVSport, "Other sports"); - AddCategoryMapping(79, TorznabCatType.TVSport, "Other sports - Rugby"); - AddCategoryMapping(78, TorznabCatType.TVSport, "Other sports - Lacrosse"); - AddCategoryMapping(77, TorznabCatType.TVSport, "Other sports - Cricket"); - AddCategoryMapping(76, TorznabCatType.TVSport, "Other sports - Volleyball"); - AddCategoryMapping(75, TorznabCatType.TVSport, "Other sports - Tennis"); - AddCategoryMapping(74, TorznabCatType.TVSport, "Other sports - Fighting"); - AddCategoryMapping(73, TorznabCatType.TVSport, "Other sports - Auto, moto racing"); - AddCategoryMapping(91, TorznabCatType.TVSport, "Other sports - Olympic Games"); - AddCategoryMapping(94, TorznabCatType.TVSport, "Other sports - Misc"); - AddCategoryMapping(56, TorznabCatType.TVSport, "Sports on tv"); - AddCategoryMapping(30, TorznabCatType.TVSport, "Sports"); - } - - private new ConfigurationDataBasicLoginWithRSSAndDisplay configData => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData; - - public override string[] LegacySiteLinks { get; protected set; } = - { - "http://720pier.ru/" - }; - - private string LoginUrl => SiteLink + "ucp.php?mode=login"; - private string SearchUrl => SiteLink + "search.php"; - - public override async Task ApplyConfiguration(JToken configJson) - { - LoadValuesFromJson(configJson); - var pairs = new Dictionary - { - { "username", configData.Username.Value }, - { "password", configData.Password.Value }, - { "redirect", "index.php" }, - { "login", "Login" }, - { "autologin", "on" } - }; - var htmlParser = new HtmlParser(); - var loginDocument = htmlParser.ParseDocument((await RequestStringWithCookies(LoginUrl, "")).Content); - pairs["creation_time"] = loginDocument.GetElementsByName("creation_time")[0].GetAttribute("value"); - pairs["form_token"] = loginDocument.GetElementsByName("form_token")[0].GetAttribute("value"); - pairs["sid"] = loginDocument.GetElementsByName("sid")[0].GetAttribute("value"); - var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, CookieHeader, true, null, LoginUrl, true); - await ConfigureIfOK( - result.Cookies, result.Content?.Contains("ucp.php?mode=logout&") == true, - () => throw new ExceptionWithConfigData(result.Content, configData)); - return IndexerConfigurationStatus.RequiresTesting; - } - - protected override async Task> PerformQuery(TorznabQuery query) - { - var searchString = query.GetQueryString(); - var keywordSearch = !string.IsNullOrWhiteSpace(searchString); - var releases = new List(); - var queryCollection = !keywordSearch - ? new NameValueCollection - { - { "search_id", "active_topics" } - } - : new NameValueCollection - { - { "sr", "posts" }, //Search all posts - { "ot", "1" }, //Search only in forums trackers (checked) - { "keywords", searchString }, - { "sf", "titleonly" } - }; - var searchUrl = SearchUrl + "?" + queryCollection.GetQueryString(); - var results = await RequestStringWithCookies(searchUrl); - if (!results.Content.Contains("ucp.php?mode=logout")) - { - await ApplyConfiguration(null); - results = await RequestStringWithCookies(searchUrl); - } - - try - { - var resultParser = new HtmlParser(); - var searchResultDocument = resultParser.ParseDocument(results.Content); - var rowSelector = keywordSearch - ? "div.search div.postbody > h3 > a" - : "ul.topics > li.row:has(i.fa-paperclip) a.topictitle"; // Torrent lines have paperclip icon. Chat topics don't - var rows = searchResultDocument.QuerySelectorAll(rowSelector); - foreach (var rowLink in rows) - { - var detailLink = SiteLink + rowLink.GetAttribute("href"); - var detailsResult = await RequestStringWithCookies(detailLink); - var detailsDocument = resultParser.ParseDocument(detailsResult.Content); - var detailRow = detailsDocument.QuerySelector("table.table2 > tbody > tr.bg1"); - if (detailRow == null) - continue; //No torrents in result - var qDownloadLink = detailRow.QuerySelector("a[href^=\"/download/torrent\"]"); - if (qDownloadLink == null) - continue; //No permission to view link - var link = new Uri(SiteLink + qDownloadLink.GetAttribute("href").TrimStart('/')); - var timestr = detailRow.Children[0].QuerySelector("ul.dropdown-contents span.my_tt").TextContent; - var publishDate = DateTimeUtil.FromUnknown(timestr, "UK"); - var forumId = detailsDocument.QuerySelector("li.breadcrumbs").LastElementChild - .GetAttribute("data-forum-id"); - var sizeString = detailRow.Children[4].QuerySelector("span.my_tt").GetAttribute("title"); - var size = ParseUtil.CoerceLong(Regex.Replace(sizeString, @"[^0-9]", string.Empty)); - var comments = new Uri(detailLink); - var grabs = ParseUtil.CoerceInt(detailRow.Children[0].QuerySelector("span.complet").TextContent); - var seeders = ParseUtil.CoerceInt(detailRow.Children[2].QuerySelector("span.seed").TextContent); - var leechers = ParseUtil.CoerceInt(detailRow.Children[3].QuerySelector("span.leech").TextContent); - var release = new ReleaseInfo - { - MinimumRatio = 1, - MinimumSeedTime = 0, - DownloadVolumeFactor = 1, - UploadVolumeFactor = 1, - Seeders = seeders, - Grabs = grabs, - Peers = leechers + seeders, - Title = rowLink.TextContent, - Comments = comments, - Guid = comments, - Link = link, - PublishDate = publishDate, - Category = MapTrackerCatToNewznab(forumId), - Size = size, - }; - releases.Add(release); - } - } - catch (Exception ex) - { - OnParseError(results.Content, ex); - } - - return releases; - } - } -}