---
  site: kinozal
  name: Kinozal
  description: "Kinozal is a RUSSIAN Semi-Private Torrent Tracker for MOVIES / TV / MUSIC"
  language: ru-ru
  type: semi-private
  encoding: windows-1251
  links:
    - http://kinozal.tv/

  caps:
    categorymappings:
      # TV
      - {id: 1001, cat: TV, desc: "All TV Shows"}
      - {id: 45, cat: TV, desc: "Russian TV Series"}
      - {id: 46, cat: TV, desc: "TV Series"}
      # Movies
      - {id: 1002, cat: Movies, desc: "All Movies"}
      - {id: 8, cat: Movies, desc: "Movies - Comedy"}
      - {id: 6, cat: Movies, desc: "Movies - Action / War"}
      - {id: 15, cat: Movies, desc: "Movies - Thriller / Detective"}
      - {id: 17, cat: Movies, desc: "Movies - Drama"}
      - {id: 35, cat: Movies, desc: "Movies - Melodrama"}
      - {id: 39, cat: Movies, desc: "Movies - Indian"}
      - {id: 13, cat: Movies, desc: "Movies - Science Fiction"}
      - {id: 14, cat: Movies, desc: "Movies - Fantasy"}
      - {id: 24, cat: Movies, desc: "Movies - Horror / Mystery"}
      - {id: 11, cat: Movies, desc: "Movies - Adventure"}
      - {id: 10, cat: Movies, desc: "Movies - Russian Movies"}
      - {id: 9, cat: Movies, desc: "Movies - Historical"}
      - {id: 47, cat: Movies, desc: "Movies - Asian"}
      - {id: 18, cat: Movies, desc: "Movies - Documentaries"}
      - {id: 37, cat: Movies, desc: "Movies - Sport"}
      - {id: 12, cat: Movies, desc: "Movies - Kids / Family"}
      - {id: 7, cat: Movies, desc: "Movies - Classic"}
      - {id: 48, cat: Movies, desc: "Movies - Concerts"}
      - {id: 49, cat: Movies, desc: "Movies - Shows / TV Shows"}
      - {id: 50, cat: Movies, desc: "Movies - TV Show Mir"}
      - {id: 38, cat: Movies, desc: "Movies - Theatre, Opera, Ballet"}
      - {id: 16, cat: Movies, desc: "Movies - Erotica"}
      # Cartoons
      - {id: 1003, cat: TV/Anime, desc: "All Cartoons/Anime"}
      - {id: 21, cat: TV/Anime, desc: "Cartoons"}
      - {id: 22, cat: TV/Anime, desc: "Cartoons - Russian"}
      - {id: 20, cat: TV/Anime, desc: "Cartoons - Anime"}
      # Music
      - {id: 1004, cat: Audio, desc: "All Music"}
      - {id: 3, cat: Audio, desc: "Music"}
      - {id: 4, cat: Audio, desc: "Music - Russian"}
      - {id: 5, cat: Audio, desc: "Music - Collections"}
      - {id: 42, cat: Audio, desc: "Music - Classical"}
      # Other
      - {id: 1006, cat: Other, desc: "Shows, Concerts, Sports"}
      - {id: 2, cat: Other, desc: "Other - AudioBooks"}
      - {id: 1, cat: Other, desc: "Other - Music Video's"}
      - {id: 23, cat: Other, desc: "Other - Games"}
      - {id: 32, cat: Other, desc: "Other - Programs"}
      - {id: 40, cat: Other, desc: "Other - Design / Graphics"}
      - {id: 41, cat: Other, desc: "Other - Library"}

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

  settings:
    - name: username
      type: text
      label: Username
    - name: password
      type: password
      label: Password
    - name: filter
      type: select
      label: Search Filter
      default: "0"
      options:
        "0" : "not selected"
        "1" : "today"
        "2" : "yesterday"
        "3" : "last 3 days"
        "4" : "per week"
        "5" : "per month"
        "6" : "less than 1.3GB"
        "7" : "1.3GB - 2.2GB"
        "8" : "2.2GB - 4.0GB"
        "9" : "4.0GB - 9.5GB"
        "10" : "9.5GB or higher"
        "11": "Gold (FreeLeech)"
        "12": "Silver (50%DL)"

  login:
    path: takelogin.php
    method: post
    inputs:
      username: "{{ .Config.username }}"
      password: "{{ .Config.password }}"
    error:
      - selector: div.bx1:has(div.red)
        message:
          selector: div.bx1 div.red
    test:
      path: userdetails.php

  search:
    paths:
    # http://kinozal.tv/browse.php?s=lucifer+2017&g=0&c=0&v=0&d=0&w=0&t=0&f=0
      - path: browse.php
    inputs:
      # multi cat is not supported. so defaulting to ALL
      c: "0"
      s: "{{ .Keywords }}"
      g: "0"
       # g= where:
       # 0 the title
       # 1 person
       # 2 genres
       # 3 regular expression
      v: "0"
      # v= format:
      # 0 all
      # 1 DVD Rip and BD (HD) Rip
      # 2 DVD-5 and DVD-9
      # 3 HD Rip (1080p 720p)
      # 4 HD Blu-Ray and Remux
      # 5 TV Rip
      # 6 3D
      # 7 4K
      # 51 Lossless
      # 52 MP3 and AAC
      # 61 PC
      # 62 Consoles
      # 63 Mobile Devices
      # 64 Navigation Devices
      d: "0"
      # d= released: 0 all, 1900 - 2017
      w: "{{ .Config.filter }}"
      # w= filter, see settings
      t: "0"
      # t= sort by
      # 0 Date
      # 1 Seeders
      # 2 Leechers
      # 3 Size
      # 4 Number Comments
      # 5 Downloads
      # 6 Latest comment datetime
      f: "0"
      # sort direction
      # 0 desc
      # 1 asc
    rows:
      selector: table > tbody > tr:has(td.bt)
    fields:
      title:
        selector: td.nam a[href^="/details.php?id="]
      details:
        selector: td.nam a[href^="/details.php?id="]
        attribute: href
      category:
        selector: td.bt img
        attribute: onclick
        filters:
          - name: re_replace
            args: ["[^\\d+]", ""]
      download:
        selector: td.nam a[href^="/details.php?id="]
        attribute: href
        filters:
          - name: replace
            args: ["details", "download"]
      size:
        selector: td:nth-child(4)
        filters:
          - name: replace
            args: ["ТБ", "TB"] 
          - name: replace
            args: ["ГБ", "GB"]
          - name: replace
            args: ["МБ", "MB"]
          - name: replace
            args: ["КБ", "KB"]
      seeders:
        selector: td:nth-child(5)
      leechers:
        selector: td:nth-child(6)
      # dates come in four flavours:
      date:
        # now
        # Today 09:10
        # Yesterday 13:04
        selector: td:nth-child(7):not(:contains("."))
        optional: true
        filters:
          - name: replace
            args: [" в", ""]
          - name: replace
            args: ["сейчас", "now"]
          - name: replace
            args: ["сегодня", "Today"]
          - name: replace
            args: ["вчера", "Yesterday"]
      date:
        # 24.10.2017 at 23:44
        selector: td:nth-child(7):contains(".")
        optional: true
        filters:
          - name: replace
            args: [" в", ""]
          - name: dateparse
            args: "02.01.2006 15:04"
      downloadvolumefactor:
        case:
          # gold
          a.r1: "0"
          # silver
          a.r2: "0.5"
          "*": "1"
      uploadvolumefactor:
          text: "1"
