From 56aba98bc9158719f6fdaa5f4956b86c5b41a04b Mon Sep 17 00:00:00 2001 From: Garfield69 Date: Wed, 14 Sep 2022 09:09:58 +1200 Subject: [PATCH] portugas: switch to API resolves #13542 append audiopt tag to title --- .../Definitions/portugas-api.yml | 169 +++++++++++++++ src/Jackett.Common/Definitions/portugas.yml | 193 ------------------ src/Jackett.Updater/Program.cs | 1 + 3 files changed, 170 insertions(+), 193 deletions(-) create mode 100644 src/Jackett.Common/Definitions/portugas-api.yml delete mode 100644 src/Jackett.Common/Definitions/portugas.yml diff --git a/src/Jackett.Common/Definitions/portugas-api.yml b/src/Jackett.Common/Definitions/portugas-api.yml new file mode 100644 index 000000000..9123ab555 --- /dev/null +++ b/src/Jackett.Common/Definitions/portugas-api.yml @@ -0,0 +1,169 @@ +--- +id: portugas-api +name: Portugas (API) +description: "Portugas is a Private Portoguese Tracker" +language: pt-PT +type: private +encoding: UTF-8 +links: + - https://portugas.org/ + +caps: + categorymappings: + - {id: 1, cat: Movies, desc: "Filmes"} + - {id: 2, cat: TV, desc: "TV"} + - {id: 3, cat: Audio, desc: "Músicas"} + - {id: 4, cat: PC/Games, desc: "Jogos"} + - {id: 5, cat: PC/0day, desc: "Appz"} + - {id: 7, cat: XXX, desc: "XXX"} + - {id: 9, cat: Books, desc: "E-Books"} + - {id: 10, cat: Movies, desc: "Animação Filmes"} + - {id: 11, cat: TV/Anime, desc: "Animação TV"} + + modes: + search: [q] + tv-search: [q, season, ep, imdbid, tvdbid, tmdbid] + movie-search: [q, imdbid, tmdbid] + music-search: [q] + book-search: [q] + +settings: + - name: apikey + type: text + label: APIKey + - name: info_key + type: info + label: About your API key + default: "Find or Generate a new API Token by accessing your Portugas account My Security page and clicking on the API Token tab." + - name: freeleech + type: checkbox + label: Search freeleech only + default: false + - name: sort + type: select + label: Sort requested from site + default: created_at + options: + created_at: created + seeders: seeders + size: size + name: title + - name: type + type: select + label: Order requested from site + default: desc + options: + desc: desc + asc: asc + +login: + path: /api/torrents + method: get + inputs: + api_token: "{{ .Config.apikey }}" + error: + - selector: a[href*="/login"] + message: + text: "The API key was not accepted by {{ .Config.sitelink }}." + +search: + paths: + # https://hdinnovations.github.io/UNIT3D-Community-Edition-Docs/api_endpoints.html + # https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/master/app/Http/Controllers/API/TorrentController.php + - path: "/api/torrents/filter" + response: + type: json + + inputs: + # if we have an id based search, add Season and Episode as query in name for UNIT3D < v6. Else pass S/E Params for UNIT3D >= v6 + api_token: "{{ .Config.apikey }}" + name: "{{ .Keywords }}" + $raw: "{{ if .Query.Season }}&seasonNumber={{ .Query.Season }}{{ else }}{{ end }}{{ if .Query.Ep }}&episodeNumber={{ .Query.Ep }}{{ else }}{{ end }}{{ if .Query.TMDBID }}&tmdbId={{ .Query.TMDBID }}{{ else }}{{ end }}{{ if .Query.IMDBIDShort }}&imdbId={{ .Query.IMDBIDShort }}{{ else }}{{ end }}{{ if .Query.TVDBID }}&tvdbId={{ .Query.TVDBID }}{{ else }}{{ end }}{{ range .Categories }}&categories[]={{.}}{{end}}{{ if .Config.freeleech }}&free=1{{ else }}{{ end }}" + sortField: "{{ .Config.sort }}" + sortDirection: "{{ .Config.type }}" + perPage: 100 + page: 1 + + keywordsfilters: + - name: re_replace + args: ["\\.", " "] + + rows: + selector: data + attribute: attributes + count: + selector: meta.total + + fields: + category: + selector: category_id + _audiopt: + selector: audio_pt + title: + selector: name + filters: + - name: append + args: "{{ if eq .Result._audiopt \"1\" }} Portuguese PT-PT{{ else }}{{ end }}" + details: + selector: details_link + download: + selector: download_link + infohash: + selector: info_hash + poster: + selector: meta.poster + filters: + - name: replace + args: ["https://via.placeholder.com/90x135", ""] + imdbid: + selector: imdb_id + tmdbid: + selector: tmdb_id + tvdbid: + selector: tvdb_id + genre: + selector: meta.genres + filters: + - name: re_replace + args: ["(?i)(Ficção científica)", "Ficção_científica"] + - name: re_replace + args: ["(?i)(Cinema TV)", "Cinema_TV"] + - name: replace + args: [" & ", "_&_"] + description: + text: "{{ .Result.genre }}" + files: + selector: num_file + seeders: + selector: seeders + leechers: + selector: leechers + grabs: + selector: times_completed + date: + # 2021-10-18T00:34:50.000000Z" + selector: created_at + size: + selector: size + downloadvolumefactor: + # api returns 0%, 25%, 50%, 75%, 100% + selector: freeleech + case: + 0%: 1 # not free + 25%: 0.75 + 50%: 0.5 + 75%: 0.25 + 100%: 0 # freeleech + "*": 0 # catch errors + uploadvolumefactor: + # api returns 0=false, 1=true + selector: double_upload + case: + 0: 1 # normal + 1: 2 # double + minimumratio: + text: 1.1 + minimumseedtime: + # 3 days (as seconds = 3 x 24 x 60 x 60) + text: 259200 +# json UNIT3D 6.3.0 (custom) diff --git a/src/Jackett.Common/Definitions/portugas.yml b/src/Jackett.Common/Definitions/portugas.yml deleted file mode 100644 index ca7a6a066..000000000 --- a/src/Jackett.Common/Definitions/portugas.yml +++ /dev/null @@ -1,193 +0,0 @@ ---- -id: portugas -name: Portugas -description: "Portugas is a Private Portuguese Tracker" -language: pt-PT -type: private -encoding: UTF-8 -links: - - https://portugas.org/ - -caps: - categorymappings: - - {id: 1, cat: Movies, desc: "Filmes"} - - {id: 2, cat: TV, desc: "TV"} - - {id: 3, cat: Audio, desc: "Músicas"} - - {id: 4, cat: PC/Games, desc: "Jogos"} - - {id: 5, cat: PC/0day, desc: "Appz"} - - {id: 7, cat: XXX, desc: "XXX"} - - {id: 9, cat: Books, desc: "E-Books"} - - {id: 10, cat: Movies, desc: "Animação Filmes"} - - {id: 11, cat: TV/Anime, desc: "Animação TV"} - - modes: - search: [q] - tv-search: [q, season, ep, imdbid, tvdbid, tmdbid] - movie-search: [q, imdbid, tmdbid] - music-search: [q] - book-search: [q] - -settings: - - name: username - type: text - label: Username - - name: password - type: password - label: Password - - name: freeleech - type: checkbox - label: Search freeleech only - default: false - - name: sort - type: select - label: Sort requested from site - default: created_at - options: - created_at: created - seeders: seeders - size: size - name: title - - name: type - type: select - label: Order requested from site - default: desc - options: - desc: desc - asc: asc - -login: - path: login - method: form - form: form[action$="/login"] - inputs: - username: "{{ .Config.username }}" - password: "{{ .Config.password }}" - remember: on - selectorinputs: - _token: - selector: input[name="_token"] - attribute: value - error: - - selector: div#ERROR_COPY -# test: -# path: / -# selector: a[href$="/logout"] - -search: - paths: - - path: torrents/filter - inputs: - $raw: "{{ range .Categories }}categories[]={{.}}&{{end}}" - search: "{{ if .Query.IMDBID }}{{ else }}{{ .Keywords }}{{ end }}" # for dashboard imdbid search - description: "" - keywords: "" - uploader: "" - imdb: "{{ .Query.IMDBIDShort }}" - tvdb: "{{ .Query.TVDBID }}" - tmdb: "{{ .Query.TMDBID }}" - mal: "" - start_year: "" - end_year: "" - sorting: "{{ .Config.sort }}" - direction: "{{ .Config.type }}" - qty: 100 - page: 0 - view: list - freeleech: "{{ if .Config.freeleech }}1{{ else }}{{ end }}" - # genre has been disabled by admin - - rows: - selector: table > tbody > tr - - fields: - category: - selector: a[href*="/categories/"] - attribute: href - filters: - - name: regexp - args: "/categories/(\\d+)" - title: - selector: a.text-bright - download: - selector: a[href*="/download/"] - attribute: href - details: - selector: a.text-bright - attribute: href - poster: - selector: div.torrent-poster img - attribute: src - filters: - - name: replace - args: ["&w=52&h=80", "&w=180&h=270"] # for display on dashboard - - name: replace - args: ["https://images.weserv.nl/?url=https://via.placeholder.com/52x80&w=180&h=270", ""] - size: - selector: td:nth-last-child(4) - seeders: - selector: td:nth-last-child(3) - leechers: - selector: td:nth-last-child(2) - grabs: - selector: td:nth-last-child(1) - date: - selector: time - filters: - # translations for Turkish|Estonian|Danish|Italian|Polish|Norwegian|Portuguese|Czech|Russian|Romanian|Spanish|French|German|Bulgarian|Dutch|Chinese|Japanese|Swedish - - name: re_replace - args: ["(?i)(önce|tagasi|geleden|fa|temu|siden|há|atrás|nazpět|назад|acum|în urmă|hace|il y a|vor|преди|前|sedan)", " ago"] - - name: re_replace - args: ["(?i)(saniye|sekundit|sekunder|secondi|sekund|segundos|sekundami|секунд|secunde|secondes|Sekunden|секунди|seconden|秒前)", "seconds"] - - name: re_replace - args: ["(?i)(minutit|minutter|minuti|minuty|minutos|минуты|минут|Minuten|минути|minuten|minuter)", "minutes"] - - name: re_replace - args: ["(?i)(dakika|minut|minuto|minuta|minutt|минута|Minute|minuut|分钟|分)", " minute"] - - name: re_replace - args: ["(?i)(tundi|timer|ore|godziny|horas|hodiny|hoden|часа|часов|ore|heures|Stunden|timmar)", "hours"] - - name: re_replace - args: ["(?i)(saat|tund|time|ora|godzina|hora|hodina|час|oră|heure|Stunde|uur|小时|時間|timme)", " hour"] - - name: re_replace - args: ["(?i)(päeva|dage|giorni|dni|dias|dny|дня|дней|zile|días|jours|Tagen|дни|dagen|dagar)", "days"] - - name: re_replace - args: ["(?i)(gün|päev|dag|giorno|dzień|dia|den|день|zi|día|jour|Tag|ден|天|日)", " day"] - - name: re_replace - args: ["(?i)(nädalat|uger|settimane|tygodnie|uker|semanas|týdny|недели|недель|săptămâni|semaines|Wochen|седмици|weken|veckor)", "weeks"] - - name: re_replace - args: ["(?i)(hafta|nädal|uge|settimana|tydzień|uke|semana|týden|неделю|săptămână|semaine|Woche|седмица|周|週間|vecka)", " week"] - - name: re_replace - args: ["(?i) (ay)", "month"] - - name: re_replace - args: ["(?i)(kuud|måneder|mesi|miesiące|meses|měsíce|месяца|месяцев|luni|meses|mois|Monaten|месеца|maanden|månader)", "months"] - - name: re_replace - args: ["(?i)(kuu|måned|mese|miesiąc|mês|měsíc|месяц|lună|mes|Monat|месец|maand|个月|ヶ月|månad)", " month"] - - name: re_replace - args: ["(?i)(aastat|anni|lata|anos|roky|года|ani|años|ans|Jahren|години)", " years"] - - name: re_replace - args: ["(?i)(yil|aasta|år|anno|rok|ano|год|año|Jahr|година|jaar|年)", " year"] - - name: re_replace - args: ["(?i) (an)", "year"] - - name: re_replace - args: ["(?i)(För |und)", ""] # Misc removals - - name: timeago - downloadvolumefactor: - case: - i[class*="fa-id-badge text-orange"]: 0 # 24 Hour FreeLeech From PARA Store - i[class*="fa-trophy text-purple"]: 0 # Special FreeLeech For Certain User Groups - i[class*="fa-star text-bold"]: 0 # Freeleech From Token - i[class*="fa-coins text-bold"]: 0 # Freeleech From Token - i[class*="fa-globe text-blue"]: 0 # Global Freeleech - i[class*="fa-star text-gold"]: 0 # Freeleech - i[class*="fa-certificate text-pink"]: 0 # Featured Torrent - "*": 1 - uploadvolumefactor: - case: - i[class*="fa-gem text-green"]: 2 # Single Torrent Double Upload - i[class*="fa-globe text-green"]: 2 # Global Double Upload - i[class*="fa-certificate text-pink"]: 2 # Featured Torrent - "*": 1 - minimumratio: - text: 1.1 - minimumseedtime: - # 3 days (as seconds = 3 x 24 x 60 x 60) - text: 259200 -# UNIT3D 4.0.0 diff --git a/src/Jackett.Updater/Program.cs b/src/Jackett.Updater/Program.cs index e0aff1bae..d9eff010c 100644 --- a/src/Jackett.Updater/Program.cs +++ b/src/Jackett.Updater/Program.cs @@ -454,6 +454,7 @@ namespace Jackett.Updater "Definitions/polishtracker.yml", "Definitions/pornolive.yml", "Definitions/pornorip.yml", + "Definitions/portugas.yml", // switch to *-API #13542 "Definitions/ps4-torrent.yml", "Definitions/pt99.yml", "Definitions/qctorrent.yml",