diff --git a/README.md b/README.md index 333285816d759d4737c88c13445d4fb0782d7897..6f2c95c00f4ea0686900cfa0c24868cab9c65714 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ Developer note: The software implements the [Torznab](https://github.com/Sonarr/ * Metal Tracker * MVGroup Forum * MVGroup Main + * Newstudio * NetHD * RuTracker * SkTorrent diff --git a/src/Jackett.Common/Definitions/newstudio.yml b/src/Jackett.Common/Definitions/newstudio.yml new file mode 100644 index 0000000000000000000000000000000000000000..349352581a022bbe9cfade037cfec5f2edb4289c --- /dev/null +++ b/src/Jackett.Common/Definitions/newstudio.yml @@ -0,0 +1,101 @@ +--- + site: newstudio + name: Newstudio + description: "newstudio" + language: ru-ru + type: semi-private + encoding: UTF-8 + links: + - http://newstudio.tv + + caps: + categorymappings: + - {id: 6, cat: TV, desc: "TV series"} + + modes: + search: [q] + tv-search: [q, season, ep] + + login: + path: /login.php + method: post + inputs: + login: 1 + login_username: "{{ .Config.username }}" + login_password: "{{ .Config.password }}" + error: + - selector: div.alert-error + test: + path: "/" + selector: a[href="/login.php?logout=1"] + + search: + paths: + - path: "/tracker.php?nm={{ .Keywords}}" + - path: "/tracker.php?nm={{ .Keywords}}&start=50" + - path: "/tracker.php?nm={{ .Keywords}}&start=100" + - path: "/tracker.php?nm={{ .Keywords}}&start=150" + rows: + selector: table.well > tbody > tr:has(a[href^="./viewtopic.php?t="]) + filters: + - name: andmatch + fields: + title: + selector: a[href^="./viewtopic.php?t="] > b + filters: + - name: re_replace + args: ["\\b(\\d)\\b", "0$1"] + - name: re_replace + args: [".+Сезон\\s+(\\d+)(?:.+Серия\\s+(\\d+))*[\\s\\S]*\\/\\s+(.+)\\s+\\(\\d+\\)\\s+(\\S*)\\s*(\\w*\\d*).*", "$3 - S$1E$2 - rus $5 $4 newstudio"] + - name: replace + args: ["WEBDLRip","WEBDL"] + - name: replace + args: ["E -","E01-99 -"] + details: + selector: a[href^="./viewtopic.php?t="] + attribute: href + download: + selector: a[href^="./download.php?id="] + attribute: href + size: + selector: td:nth-child(5) > a + date: + # 27-Окт-17 + selector: td:nth-child(6) + filters: + # replace white spaces + - name: re_replace + args: ["(Сегодня|Вчера|\\s|,|-)+", " "] + # replace month abbreviations + - name: replace + args: ["Янв", "Jan"] + - name: replace + args: ["Фев", "Feb"] + - name: replace + args: ["Мар", "Mar"] + - name: replace + args: ["Апр", "Apr"] + - name: replace + args: ["Май", "May"] + - name: replace + args: ["Июн", "Jun"] + - name: replace + args: ["Июл", "Jul"] + - name: replace + args: ["Авг", "Aug"] + - name: replace + args: ["Сен", "Sep"] + - name: replace + args: ["Окт", "Oct"] + - name: replace + args: ["Ноя", "Nov"] + - name: replace + args: ["Дек", "Dec"] + - name: append + args: " 00:00:00 +05:00" + - name: dateparse + args: "02 Jan 06 15:04:15 -07:00" + downloadvolumefactor: + text: "0" + uploadvolumefactor: + text: "1" \ No newline at end of file diff --git a/src/Jackett.Common/Definitions/rutor.yml b/src/Jackett.Common/Definitions/rutor.yml index 5fd7bee4dc5aa00d796938427a1aa28172f65773..4479a5651742a1a6591718c4929a16caf45f2de9 100644 --- a/src/Jackett.Common/Definitions/rutor.yml +++ b/src/Jackett.Common/Definitions/rutor.yml @@ -15,8 +15,8 @@ categorymappings: # - {id: 1, cat: Movies/Foreign, desc: "Foreign films"} # - {id: 2, cat: Audio, desc: "Music"} - - {id: 3, cat: Other, desc: "Other"} -# - {id: 4, cat: TV, desc: "TV Shows"} +# - {id: 3, cat: Other, desc: "Other"} + - {id: 4, cat: TV, desc: "TV Shows"} # - {id: 5, cat: Movies, desc: "Russian films"} # - {id: 6, cat: TV, desc: "TV"} # - {id: 7, cat: Movies, desc: "Animation"} @@ -51,18 +51,22 @@ search: paths: # http://rutor.info/search/0/0/000/0/gotham%2004x01 - - path: "{{ if .Keywords }}search/0/0/{{ .Config.method }}00/0/{{ .Keywords }}{{else}}top{{end}}" + - path: "{{ if .Query.Q }}search/0/0/{{ .Config.method }}00/0/{{ .Query.Q }}{{else}}top{{end}}" rows: selector: table > tbody > tr:has(td:has(a.downgif)) fields: title: selector: td:nth-of-type(2) a:nth-of-type(3) + filters: + - name: re_replace + args: [".+\\/\\s([^а-яА-я\\/]+)\\s.*\\[(?:S*(\\d+))(?:x*(\\d+-*\\d*).*)*\\].*\\)\\s+(.+)\\s+(?:\\||от)\\s*(.+)","$1 - S$2E$3 - rus - $4 - $5"] + - name: replace + args: ["E -", "E01-99 -"] + - name: replace + args: ["Кураж-Бамбей", "kurazh"] details: selector: td:nth-of-type(2) a:nth-of-type(3) attribute: href - category: - # Category=Other - text: "3" download: selector: td:nth-of-type(2) a:nth-of-type(1) attribute: href diff --git a/src/Jackett.Common/Indexers/rutracker.cs b/src/Jackett.Common/Indexers/rutracker.cs index 33d044ac7becb33d8574ce84295435c255bbed32..d661d130fa204ecfa21de7ad6b74d7514afd93d5 100644 --- a/src/Jackett.Common/Indexers/rutracker.cs +++ b/src/Jackett.Common/Indexers/rutracker.cs @@ -11,6 +11,7 @@ using Jackett.Utils; using Jackett.Utils.Clients; using Newtonsoft.Json.Linq; using NLog; +using System.Text.RegularExpressions; namespace Jackett.Indexers { @@ -1498,7 +1499,7 @@ namespace Jackett.Indexers protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) { var releases = new List<ReleaseInfo>(); - var searchString = query.GetQueryString(); + var searchString = query.SanitizedSearchTerm; var queryCollection = new NameValueCollection(); @@ -1510,6 +1511,10 @@ namespace Jackett.Indexers else // use the normal search { searchString = searchString.Replace("-", " "); + if (query.Season != 0) + { + searchString += " Сезон: " + query.Season; + } queryCollection.Add("nm", searchString); } @@ -1545,6 +1550,7 @@ namespace Jackett.Indexers var qSize = Row.QuerySelector("td.tor-size > u"); release.Title = qDetailsLink.TextContent; + release.Comments = new Uri(SiteLink + "forum/" + qDetailsLink.GetAttribute("href")); release.Link = new Uri(SiteLink + "forum/" + qDownloadLink.GetAttribute("href")); release.Guid = release.Comments; @@ -1567,6 +1573,21 @@ namespace Jackett.Indexers release.DownloadVolumeFactor = 1; release.UploadVolumeFactor = 1; + if (release.Category.Contains(TorznabCatType.TV.ID)) + { + // extract season and episodes + var regex = new Regex(".+\\/\\s([^а-яА-я\\/]+)\\s\\/.+Сезон\\s*[:]*\\s+(\\d+).+(?:Серии|Эпизод)+\\s*[:]*\\s+(\\d+-*\\d*).+,\\s+(.+)\\].+(\\(.+\\)).*"); + + var title = regex.Replace(release.Title, "$1 - S$2E$3 - rus $4 $5"); + title = Regex.Replace(title, "-Rip", "Rip", RegexOptions.IgnoreCase); + title = Regex.Replace(title, "WEB-DLRip", "WEBDL", RegexOptions.IgnoreCase); + title = Regex.Replace(title, "WEB-DL", "WEBDL", RegexOptions.IgnoreCase); + title = Regex.Replace(title, "HDTVRip", "HDTV", RegexOptions.IgnoreCase); + title = Regex.Replace(title, "Кураж-Бамбей", "kurazh", RegexOptions.IgnoreCase); + + release.Title = title; + } + releases.Add(release); } catch (Exception ex)