From dc1961b10580228d6448625f1ca3f2f0ad0df411 Mon Sep 17 00:00:00 2001 From: Garfield69 Date: Mon, 24 Jan 2022 20:45:26 +1300 Subject: [PATCH] bitcityreloaded: C# -> yml with cat updates sort options and ULVF detection new descr --- .../Definitions/bitcityreloaded.yml | 161 +++++++++++++ .../Indexers/BitCityReloaded.cs | 224 ------------------ 2 files changed, 161 insertions(+), 224 deletions(-) create mode 100644 src/Jackett.Common/Definitions/bitcityreloaded.yml delete mode 100644 src/Jackett.Common/Indexers/BitCityReloaded.cs diff --git a/src/Jackett.Common/Definitions/bitcityreloaded.yml b/src/Jackett.Common/Definitions/bitcityreloaded.yml new file mode 100644 index 000000000..7288f2568 --- /dev/null +++ b/src/Jackett.Common/Definitions/bitcityreloaded.yml @@ -0,0 +1,161 @@ +--- +id: bitcityreloaded +name: Bit-City Reloaded +description: "Bit-City Reloaded is a GERMAN Private Torrent Tracker for MOVIES / TV / GENERAL" +language: de-DE +type: private +encoding: ISO-8859-1 +links: + - https://bc-reloaded.net/ + +caps: + categorymappings: + - {id: 1, cat: Other, desc: "Anderes"} + - {id: 34, cat: PC, desc: "Appz/Linux"} + - {id: 35, cat: PC/Mac, desc: "Appz/Mac"} + - {id: 36, cat: PC, desc: "Appz/Other"} + - {id: 20, cat: PC/0day, desc: "Appz/Win"} + - {id: 4, cat: Books/EBook, desc: "EBooks"} + - {id: 10, cat: PC/Games, desc: "Games/PC"} + - {id: 15, cat: PC/Mobile-Android, desc: "Handy & PDA"} + - {id: 16, cat: Audio/Audiobook, desc: "Hörspiel/Hörbuch"} + - {id: 30, cat: Movies/Foreign, desc: "International"} + - {id: 43, cat: Movies/3D, desc: "Movie/3D"} + - {id: 6, cat: Movies/HD, desc: "Movie/HD 1080p"} + - {id: 7, cat: Movies/HD, desc: "Movie/HD 720p"} + - {id: 17, cat: Movies/Other, desc: "Movie/MegaPack"} + - {id: 9, cat: Movies/SD, desc: "Movie/SD"} + - {id: 26, cat: XXX, desc: "Movie/XXX"} + - {id: 41, cat: XXX/Other, desc: "Movie/XXX/Other"} + - {id: 42, cat: XXX/Pack, desc: "Movie/XXX/Pack"} + - {id: 45, cat: Movies/UHD, desc: "Movies/4K"} + - {id: 33, cat: Movies/BluRay, desc: "Movies/BluRay"} + - {id: 19, cat: Audio/Video, desc: "Musik Videos"} + - {id: 18, cat: Audio, desc: "Musik/MP3/Flac"} + - {id: 13, cat: Console/WiiU, desc: "Nintendo"} + - {id: 12, cat: Console/PS4, desc: "Playstation"} + - {id: 22, cat: TV/HD, desc: "Serie/HD"} + - {id: 38, cat: TV, desc: "Serie/Pack"} + - {id: 23, cat: TV/SD, desc: "Serie/SD"} + - {id: 25, cat: TV/Sport, desc: "Sport"} + + modes: + search: [q] + tv-search: [q, season, ep] + movie-search: [q] + music-search: [q] + book-search: [q] + +settings: + - name: username + type: text + label: Username + - name: password + type: password + label: Password + - name: freeleech + type: checkbox + label: Filter freeleech only + default: false + - name: sort + type: select + label: Sort requested from site + default: added + options: + added: created + seeds: seeders + size: size + name: title + - name: type + type: select + label: Order requested from site + default: desc + options: + desc: desc + asc: asc + - name: info_tpp + type: info + label: Results Per Page + default: For best results, change the Anzahl der Torrents beim Durchsuchen setting to 100 on your account profile. + +login: + path: login/index.php + method: post + inputs: + username: "{{ .Config.username }}" + password: "{{ .Config.password }}" + error: + - selector: div#login_error + test: + path: / + selector: a[href="logout.php"] + +search: + paths: + # https://bc-reloaded.net/uebersicht.php?c7=1&c17=1&showsearch=1&search=2021+720p&blah=0&incldead=1&orderby=added&sort=desc + - path: uebersicht.php + inputs: + $raw: "{{ range .Categories }}c{{.}}=1&{{end}}" + showsearch: 1 + search: "{{ .Keywords }}" + # 0 name, 1 descr, 2 both, 3 noDVDRip + blah: 0 + # 0 active, 1 incldead, 2 onlydead + incldead: 1 + orderby: "{{ .Config.sort }}" + sort: "{{ .Config.type }}" + # site does not support imdbid searching or display imdb links in results. + + rows: + selector: "table.tableinborder[cellpadding=0] > tbody > tr{{ if .Config.freeleech }}:has(img[src$=\"torrent_ou.gif\"]){{ else }}{{ end }}" + filters: + - name: andmatch + + fields: + category: + selector: a[href^="uebersicht.php?cat="] + attribute: href + filters: + - name: querystring + args: cat + title: + selector: a[href^="details.php?id="] + details: + selector: a[href^="details.php?id="] + attribute: href + download: + selector: a[href^="download.php"] + attribute: href + date: + selector: table tbody tr:nth-of-type(2) td:nth-of-type(5) + filters: + - name: re_replace + args: ["\u00a0", " "] + - name: append + args: " +01:00" # CET + - name: dateparse + args: "02.01.2006 15:04:05 -07:00" + size: + selector: table tbody tr:nth-of-type(2) td b + files: + selector: td:has(a[href*="&filelist=1"])> b:nth-child(2) + grabs: + selector: td:has(a[href*="&tosnatchers=1"])> b:nth-child(1) + seeders: + selector: table tbody tr:nth-of-type(2) td:nth-of-type(2) b:nth-of-type(1) font + leechers: + selector: table tbody tr:nth-of-type(2) td:nth-of-type(2) b:nth-of-type(2) font + downloadvolumefactor: + case: + img[src$="torrent_ou.gif"]: 0 + "*": 1 + uploadvolumefactor: + case: + img[src$="torrent_2u.gif"]: 2 + "*": 1 + minimumratio: + text: 0.7 + minimumseedtime: + # 2 days (as seconds = 2 x 24 x 60 x 60) + text: 172800 +# engine n/a diff --git a/src/Jackett.Common/Indexers/BitCityReloaded.cs b/src/Jackett.Common/Indexers/BitCityReloaded.cs deleted file mode 100644 index 9df299f6d..000000000 --- a/src/Jackett.Common/Indexers/BitCityReloaded.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Text; -using System.Threading.Tasks; -using AngleSharp.Dom; -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 BitCityReloaded : BaseWebIndexer - { - private string LoginUrl => SiteLink + "login/index.php"; - private string BrowseUrl => SiteLink + "uebersicht.php"; - private readonly TimeZoneInfo germanyTz = TimeZoneInfo.CreateCustomTimeZone("W. Europe Standard Time", new TimeSpan(1, 0, 0), "W. Europe Standard Time", "W. Europe Standard Time"); - - private new ConfigurationDataBasicLoginWithRSSAndDisplay configData - { - get => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData; - set => base.configData = value; - } - - public BitCityReloaded(IIndexerConfigurationService configService, WebClient wc, Logger l, - IProtectionService ps, ICacheService cs) - : base(id: "bitcityreloaded", - name: "Bit-City Reloaded", - description: "A German general tracker.", - link: "https://bc-reloaded.net/", - caps: new TorznabCapabilities - { - TvSearchParams = new List - { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep - }, - MovieSearchParams = new List - { - MovieSearchParam.Q - }, - MusicSearchParams = new List - { - MusicSearchParam.Q - }, - BookSearchParams = new List - { - BookSearchParam.Q - } - }, - configService: configService, - client: wc, - logger: l, - p: ps, - cacheService: cs, - configData: new ConfigurationDataBasicLoginWithRSSAndDisplay("Only the results from the first search result page are shown, adjust your profile settings to show a reasonable amount (it looks like there's no maximum).")) - { - Encoding = Encoding.GetEncoding("iso-8859-1"); - Language = "de-DE"; - Type = "private"; - - AddCategoryMapping(1, TorznabCatType.Other, "Other/Anderes"); - AddCategoryMapping(2, TorznabCatType.TVAnime, "TV/Anime"); - AddCategoryMapping(34, TorznabCatType.PC, "Appz/Linux"); - AddCategoryMapping(35, TorznabCatType.PCMac, "Appz/Mac"); - AddCategoryMapping(36, TorznabCatType.PC, "Appz/Other"); - AddCategoryMapping(20, TorznabCatType.PC, "Appz/Win"); - AddCategoryMapping(3, TorznabCatType.TVDocumentary, "TV/Doku/Alle Formate"); - AddCategoryMapping(4, TorznabCatType.Books, "EBooks"); - AddCategoryMapping(12, TorznabCatType.ConsolePS4, "Games/PS & PSx"); - AddCategoryMapping(11, TorznabCatType.ConsoleNDS, "Games/Nintendo DS"); - AddCategoryMapping(10, TorznabCatType.PCGames, "Games/PC"); - AddCategoryMapping(13, TorznabCatType.ConsoleWii, "Games/Wii"); - AddCategoryMapping(14, TorznabCatType.ConsoleXBox, "Games/Xbox & 360"); - AddCategoryMapping(15, TorznabCatType.PCMobileOther, "Handy & PDA"); - AddCategoryMapping(16, TorznabCatType.AudioAudiobook, "Hörspiel/Hörbuch"); - AddCategoryMapping(30, TorznabCatType.Other, "Other/International"); - AddCategoryMapping(17, TorznabCatType.Other, "Other/MegaPack"); - AddCategoryMapping(43, TorznabCatType.Movies3D, "Movie/3D"); - AddCategoryMapping(5, TorznabCatType.MoviesDVD, "Movie/DVD/R"); - AddCategoryMapping(6, TorznabCatType.MoviesHD, "Movie/HD 1080p"); - AddCategoryMapping(7, TorznabCatType.MoviesHD, "Movie/HD 720p"); - AddCategoryMapping(32, TorznabCatType.MoviesOther, "Movie/TVRip"); - AddCategoryMapping(9, TorznabCatType.MoviesOther, "Movie/XviD,DivX,h264"); - AddCategoryMapping(26, TorznabCatType.XXX, "XXX/Movie"); - AddCategoryMapping(41, TorznabCatType.XXXOther, "XXX/Movie/Other"); - AddCategoryMapping(42, TorznabCatType.XXXPack, "XXX/Movie/Pack"); - AddCategoryMapping(45, TorznabCatType.MoviesHD, "Movies/4K"); - AddCategoryMapping(33, TorznabCatType.MoviesBluRay, "Movies/BluRay"); - AddCategoryMapping(18, TorznabCatType.Audio, "Musik"); - AddCategoryMapping(19, TorznabCatType.AudioVideo, "Musik Videos"); - AddCategoryMapping(44, TorznabCatType.TVOther, "Serie/DVD/R"); - AddCategoryMapping(22, TorznabCatType.TVHD, "Serie/HDTV"); - AddCategoryMapping(38, TorznabCatType.TV, "Serie/Pack"); - AddCategoryMapping(23, TorznabCatType.TVOther, "Serie/XviD,DivX,h264"); - AddCategoryMapping(25, TorznabCatType.TVSport, "TV/Sport"); - } - - public override async Task ApplyConfiguration(JToken configJson) - { - LoadValuesFromJson(configJson); - - var pairs = new Dictionary - { - { "username", configData.Username.Value }, - { "password", configData.Password.Value } - }; - - var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, null, LoginUrl); - await ConfigureIfOK(result.Cookies, result.ContentString != null && result.ContentString.Contains("logout.php"), () => - { - var parser = new HtmlParser(); - var dom = parser.ParseDocument(result.ContentString); - var errorMessage = dom.QuerySelector("#login_error").Text().Trim(); - throw new ExceptionWithConfigData(errorMessage, configData); - }); - return IndexerConfigurationStatus.RequiresTesting; - } - - protected override async Task> PerformQuery(TorznabQuery query) - { - var releases = new List(); - - var searchString = query.GetQueryString(); - var searchUrl = BrowseUrl; - var queryCollection = new NameValueCollection - { - { "showsearch", "0" }, - { "incldead", "1" }, - { "blah", "0" }, - { "team", "0" }, - { "orderby", "added" }, - { "sort", "desc" } - }; - - if (!string.IsNullOrWhiteSpace(searchString)) - queryCollection.Add("search", searchString); - - foreach (var cat in MapTorznabCapsToTrackers(query)) - queryCollection.Add("c" + cat, "1"); - - searchUrl += "?" + queryCollection.GetQueryString(); - - var response = await RequestWithCookiesAndRetryAsync(searchUrl, referer: BrowseUrl); - var results = response.ContentString; - try - { - var parser = new HtmlParser(); - var dom = parser.ParseDocument(results); - var rows = dom.QuerySelectorAll("table.tableinborder[cellpadding=0] > tbody > tr"); - - foreach (var row in rows) - { - var release = new ReleaseInfo - { - MinimumRatio = 0.7, - MinimumSeedTime = 172800, // 48 hours - DownloadVolumeFactor = 1, - UploadVolumeFactor = 1 - }; - - var flagImgs = row.QuerySelectorAll("table tbody tr:nth-of-type(1) td > img"); - var flags = new List(); - foreach (var flagImg in flagImgs) - { - var flag = flagImg.GetAttribute("src").Replace("pic/torrent_", "").Replace(".gif", "").ToUpper(); - if (flag == "OU") - release.DownloadVolumeFactor = 0; - else - flags.Add(flag); - } - - var titleLink = row.QuerySelector("table tbody tr:nth-of-type(1) td a:has(b)"); - var dlLink = row.QuerySelector("td.tableb > a:has(img[title=\"Torrent herunterladen\"])"); - release.Details = new Uri(SiteLink + titleLink.GetAttribute("href").Replace("&hit=1", "")); - release.Link = new Uri(SiteLink + dlLink.GetAttribute("href")); - release.Title = titleLink.TextContent.Trim(); - - if (!query.MatchQueryStringAND(release.Title)) - continue; - - release.Description = string.Join(", ", flags); - release.Guid = release.Link; - - var dateStr = row.QuerySelector("table tbody tr:nth-of-type(2) td:nth-of-type(5)").Html().Replace(" ", " ").Trim(); - var dateGerman = DateTime.SpecifyKind(DateTime.ParseExact(dateStr, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture), DateTimeKind.Unspecified); - var pubDateUtc = TimeZoneInfo.ConvertTimeToUtc(dateGerman, germanyTz); - release.PublishDate = pubDateUtc.ToLocalTime(); - - var sizeStr = row.QuerySelector("table tbody tr:nth-of-type(2)").QuerySelector("td b").TextContent.Trim(); - release.Size = ReleaseInfo.GetBytes(sizeStr); - - release.Seeders = ParseUtil.CoerceInt(row.QuerySelector("table tbody tr:nth-of-type(2) td:nth-of-type(2) b:nth-of-type(1) font").TextContent.Trim()); - release.Peers = ParseUtil.CoerceInt(row.QuerySelector("table tbody tr:nth-of-type(2) td:nth-of-type(2) b:nth-of-type(2) font").TextContent.Trim()) + release.Seeders; - - var catId = row.QuerySelector("td:nth-of-type(1) a").GetAttribute("href").Split('=')[1]; - release.Category = MapTrackerCatToNewznab(catId); - - var files = row.QuerySelector("td:has(a[href*=\"&filelist=1\"])> b:nth-child(2)").TextContent; - release.Files = ParseUtil.CoerceInt(files); - - var grabs = row.QuerySelector("td:has(a[href*=\"&tosnatchers=1\"])> b:nth-child(1)").TextContent; - release.Grabs = ParseUtil.CoerceInt(grabs); - - releases.Add(release); - } - } - catch (Exception ex) - { - OnParseError(results, ex); - } - - return releases; - } - } -} -