---
  site: torrent-turk
  name: TOrrent-tuRK
  description: "TOrrent-tuRK (TORK) is a Turkish Private Torrent Tracker for HD MOVIES / TV / GENERAL"
  language: tr-TR
  type: private
  encoding: UTF-8
  links:
    - https://torrent-turk.org/
  
  caps:
    categorymappings:
      - {id: 149, cat: Movies, desc: "Movies/Turkish"}
      - {id: 151, cat: Movies/HD, desc: "Movies/Turkish/1080p"}
      - {id: 152, cat: Movies/HD, desc: "Movies/Turkish/720p"}

      - {id: 156, cat: Movies, desc: "Movies/Foreign"}
      - {id: 157, cat: Movies/UHD, desc: "Movies/Foreign/4K"}
      - {id: 159, cat: Movies/HD, desc: "Movies/Foreign/1080p"}
      - {id: 160, cat: Movies/HD, desc: "Movies/Foreign/720p"}
      
      - {id: 164, cat: TV, desc: "TV"}
      - {id: 165, cat: TV, desc: "TV/Turkish"}
      - {id: 166, cat: TV, desc: "TV/Foreign"}

      - {id: 171, cat: Audio, desc: "Music"}
      - {id: 172, cat: Audio, desc: "Music/Turkish"}
      - {id: 173, cat: Audio, desc: "Music/Foreign"}
    
    modes:
      search: [q]
      tv-search: [q]
      movie-search: [q]
      
  login:
    path: /?p=home&pid=1
    method: form
    form: form#loginbox_form
    submitpath: /ajax/login.php
    inputs:
      action: "login"
      loginbox_membername: "{{ .Config.username }}"
      loginbox_password: "{{ .Config.password }}"
      loginbox_remember: "true"
    selectorinputs:
      securitytoken:
        selector: "script:contains(\"stKey: \")"
        filters:
          - name: regexp
            args: "stKey: \"(.+?)\","
    error:
      - selector: ":contains(\"-ERROR-\")"
    test:
      path: /?p=torrents&type=bookmarks&pid=508
      selector: a#logout
      
  search:
    paths:
      - path: /
    keywordsfilters: 
      - name: re_replace
        args: ["[^a-zA-Z0-9]+", "%25"]
    inputs:
      p: "torrents"
      pid: "32"
      $raw: "{{range .Categories}}cid[]={{.}}&{{end}}"
      keywords: "{{ .Keywords }}"
      search_type: "name"
      searchin: "title"
    error:
      - selector: div.error:not(:contains("Hiçbir sonuç bulunamadı."))
    rows:
      selector: table#torrents_table_classic > tbody > tr:has(td.torrent_name)
    fields:
      title:
        selector: a[href*="?p=torrents&pid=10&action=details"]
      category:
        selector: div.category_image > a
        attribute: href
        filters:
          - name: querystring
            args: cid
      details:
        selector: a[href*="?p=torrents&pid=10&action=details"]
        attribute: href
      download:
        selector: a[href*="?p=torrents&pid=10&action=download"]
        attribute: href
      size:
        selector: a[rel="torrent_size"]
      seeders:
        selector: a[rel="torrent_seeders"]
      leechers:
        selector: a[rel="torrent_leechers"]
      grabs:
        selector: a[rel="times_completed"]
      banner:
        selector: a[rel="fancybox"]
        optional: true
        attribute: href
      downloadvolumefactor:
        case:
          "img[title=\"FREE!\"]": "0"
          "*": "1"
      uploadvolumefactor:
        case:
          "*": "1"
      date:
        selector: td.torrent_name > abbr.timeago
        optional: true
        attribute: data-time
