From 9c3f1134b9a8860751f959c7fc659be7974cf4e9 Mon Sep 17 00:00:00 2001 From: csutcliff Date: Mon, 9 Dec 2019 23:18:13 +0000 Subject: [PATCH] Beyond-HD-oneurl: Add support for OneURL login (#6566) Quick fix for the recaptcha/2FA woes of the current method --- .../Definitions/beyond-hd-oneurl.yml | 101 ++++++++++++++++++ .../Indexers/CardigannIndexer.cs | 10 ++ 2 files changed, 111 insertions(+) create mode 100644 src/Jackett.Common/Definitions/beyond-hd-oneurl.yml diff --git a/src/Jackett.Common/Definitions/beyond-hd-oneurl.yml b/src/Jackett.Common/Definitions/beyond-hd-oneurl.yml new file mode 100644 index 000000000..c373f08ca --- /dev/null +++ b/src/Jackett.Common/Definitions/beyond-hd-oneurl.yml @@ -0,0 +1,101 @@ +--- + site: beyond-hd-oneurl + name: Beyond-HD (OneURL) + description: "Without BeyondHD, your HDTV is just a TV" + language: en-us + type: private + encoding: UTF-8 + links: + - https://beyond-hd.me/ + + settings: + - name: oneurl + type: text + label: OneURL + + caps: + categorymappings: + - {id: 1, cat: Movies, desc: "Movies"} + - {id: 2, cat: TV, desc: "TV"} + + modes: + search: [q] + tv-search: [q, season, ep, imdbid] + movie-search: [q, imdbid] + + login: + method: oneurl + inputs: + oneurl: "{{ .Config.oneurl }}" + test: + path: torrents + + search: + paths: + - path: torrents + inputs: + $raw: "{{range .Categories}}categories[]={{.}}&{{end}}" + search: "{{if .Query.IMDBID}}{{else}}{{ .Keywords }}{{end}}" + description: "" + uploader: "" + imdb: "{{ .Query.IMDBIDShort }}" + tmdb: "" + sorting: created_at + direction: desc + qty: 100 + rows: + selector: table > tbody > tr + after: 1 + fields: + _category: + selector: a[href*="/categories/"] + optional: true + attribute: href + filters: + - name: regexp + args: "/categories/.*?\\.(\\d+)" + category: + text: "{{if .Result._category}}{{.Result._category}}{{else}}1{{end}}" + title: + selector: a.torrent-name + download: + selector: a[href*="/download/"] + attribute: href + details: + selector: a.torrent-name + attribute: href + banner: + optional: true + selector: div.torrent-poster img + attribute: src + filters: + - name: replace + args: ["/img/person.png", ""] + date: + selector: td:not(a[href$="/history"]) span.text-orange + filters: + - name: timeago + size: + selector: td span.text-blue + seeders: + selector: a[href$="/peers"] span.text-green + leechers: + selector: a[href$="/peers"] span.text-red + grabs: + selector: a[href$="/history"] + imdb: + optional: true + selector: a[href*="www.imdb.com/title/tt"] + attribute: href + downloadvolumefactor: + case: + i[data-original-title="100% Free"]: "0" + i[data-original-title="100% Free (Limited UL)"]: "0" + i[data-original-title="25% Promo"]: "0.75" + i[data-original-title="50% Promo"]: "0.5" + i[data-original-title="75% Promo"]: "0.25" + "*": "1" + uploadvolumefactor: + case: + "*": "1" +# UNIT3D \ No newline at end of file diff --git a/src/Jackett.Common/Indexers/CardigannIndexer.cs b/src/Jackett.Common/Indexers/CardigannIndexer.cs index 6b200772d..977700def 100644 --- a/src/Jackett.Common/Indexers/CardigannIndexer.cs +++ b/src/Jackett.Common/Indexers/CardigannIndexer.cs @@ -659,6 +659,16 @@ namespace Jackett.Common.Indexers checkForError(loginResult, Definition.Login.Error); } + else if (Login.Method == "oneurl") + { + var OneUrl = applyGoTemplateText(Definition.Login.Inputs["oneurl"]); + var LoginUrl = resolvePath(Login.Path + OneUrl).ToString(); + configData.CookieHeader.Value = null; + var loginResult = await RequestStringWithCookies(LoginUrl, null, SiteLink); + configData.CookieHeader.Value = loginResult.Cookies; + + checkForError(loginResult, Definition.Login.Error); + } else { throw new NotImplementedException("Login method " + Definition.Login.Method + " not implemented");