---
  site: passionetorrent
  name: Passione Torrent
  description: "PassioneTorrent is an ITALIAN Private Torrent Tracker for MOVIES / TV / GENERAL"
  language: it-it
  type: private
  encoding: UTF-8
  links:
    - http://www.passionetorrent.info/

  caps:
    categorymappings:
      # VIDEO
      - {id: 1, cat: Movies, desc: "News Cinema"}
      - {id: 2, cat: Movies/SD, desc: "BDRip"}
      - {id: 17, cat: Movies/SD, desc: "DVDRip"}
      - {id: 21, cat: TV, desc: "TV"}
      - {id: 22, cat: Movies/HD, desc: "720p/1080p"}
      - {id: 23, cat: Movies/HD, desc: "1080p HRS x265 HEVC"}
      - {id: 42, cat: Movies/HD, desc: "2160p 4k UltraHD HRS"}
      - {id: 30, cat: TV/Anime, desc: "Cartoons"}
      - {id: 38, cat: Movies/SD, desc: "BD-BR-DvdRip sub ita"}
      - {id: 39, cat: Movies/SD, desc: "Introvabili"}
      - {id: 40, cat: TV/Documentary, desc: "documentaries"}
      - {id: 24, cat: Movies/SD, desc: "Filmografie"}

      # MUSICA
      - {id: 32, cat: Audio, desc: "Italian music"}
      - {id: 41, cat: Audio, desc: "Discography"}
      - {id: 33, cat: Audio, desc: "MusicaInternazionale"}
      - {id: 34, cat: Audio, desc: "Compilation"}

      # PDF
      - {id: 28, cat: Books, desc: "Ebook"}

      # GAMES
      - {id: 14, cat: PC/Games, desc: "PC Games"}

      # SOFTWARE
      - {id: 7, cat: PC/ISO, desc: "Sistemi operativi"}
      - {id: 36, cat: PC/ISO, desc: "Windows APP"}
      - {id: 9, cat: PC/Phone-IOS, desc: "Apple APP"}
      - {id: 37, cat: PC/Phone-Android, desc: "Android APP"}

    modes:
      search: [q]
      tv-search: [q, season, ep, imdbid]
      movie-search: [q, imdbid]

  login:
    path: index.php?page=login
    method: post
    inputs:
      uid: "{{ .Config.username }}"
      pwd: "{{ .Config.password }}"
    error:
      - selector: body[onLoad^="makeAlert('"]
        message:
          selector: body[onLoad^="makeAlert('"]
          attribute: onLoad
          filters:
            - name: replace
              args: ["makeAlert('Error' , '", ""]
            - name: replace
              args: ["');", ""]
    test:
      path: index.php

  download:
    before:
      path: "thanks.php"
      method: "post"
      inputs:
        infohash: "{{ .DownloadUri.Query.id }}"
        thanks: "1"
        rndval: "1487013827343"
    selector: a[href^="download.php?id="]

  search:
    paths:
      - path: index.php
    keywordsfilters:
      # most ITA TV torrents are in XXxYY format, so we search without S/E prefixes and filter later
      - name: re_replace
        args: ["S0?(\\d{1,2})", " $1 "]
      - name: re_replace
        args: ["E(\\d{2,3})", " $1 "]
      - name: replace
        args: ["-", ""]
    inputs:
      search: "{{if .Query.IMDBID}}{{ .Query.IMDBIDShort }}{{else}}{{ .Keywords }}{{end}}"
      page: "torrents"
      category: "{{range .Categories}}{{.}};{{end}}"
      options: "{{ if .Query.IMDBID }}4{{else}}0{{end}}"
      active: "0"
    rows:
      selector: table > tbody > tr > td > table.lista > tbody > tr:has(a[href^="index.php?page=torrent-details&id="])
    fields:
      download:
        selector: a[href^="index.php?page=downloadcheck&id="]
        attribute: href
      title:
        selector: a[onmouseover][href^="index.php?page=torrent-details&id="]
        filters:
          # normalize to SXXEYY format
          - name: re_replace
            args: ["(\\d{2})x(\\d{2})", "S$1E$2"]
          - name: re_replace
            args: ["(\\d{1})x(\\d{2})", "S0$1E$2"]
      banner:
        selector: a[onmouseover][href^="index.php?page=torrent-details&id="]
        attribute: onmouseover
        filters:
          - name: regexp
            args: "src=(.*?) "
      category:
        selector: a[href^="index.php?page=torrents&category="]
        attribute: href
        filters:
          - name: querystring
            args: category
      details:
        selector: a[onmouseover][href^="index.php?page=torrent-details&id="]
        attribute: href
      size:
        selector: td:nth-last-child(4)
      date:
        selector: td:nth-last-child(8)
        filters:
          - name: append
            args: " +01:00"
          - name: dateparse
            args: "02/01/2006 -07:00"
      grabs:
        selector: td:nth-last-child(7)
        filters:
          - name: replace
            args: ["---", "0"]
      seeders:
        selector: td:nth-last-child(5)
      leechers:
        selector: td:nth-last-child(6)
      downloadvolumefactor:
        case:
          img[alt="Gold 100% Free"]: "0"
          img[alt="Silver 50% Free"]: "0.5"
          img[alt="Bronze 25% Free"]: "0.75"
          "*": "1"
      uploadvolumefactor:
        case:
          img[alt="2x Upload Multiplier"]: "2"
          img[alt="3x Upload Multiplier"]: "3"
          img[alt="4x Upload Multiplier"]: "4"
          img[alt="5x Upload Multiplier"]: "5"
          img[alt="6x Upload Multiplier"]: "6"
          img[alt="7x Upload Multiplier"]: "7"
          img[alt="8x Upload Multiplier"]: "8"
          img[alt="9x Upload Multiplier"]: "9"
          img[alt="10x Upload Multiplier"]: "10"
          "*": "1"
