---
id: hdai
name: HDAI
description: "HDAI is a CHINESE Private Torrent Tracker for HD MOVIES / TV / GENERAL"
language: zh-CN
type: private
encoding: UTF-8
links:
  - https://www.hd.ai/

caps:
  categorymappings:
    - {id: 1, cat: Movies, desc: "电影Movies"}
    - {id: 2, cat: TV, desc: "电视剧TV Series"}
    - {id: 3, cat: TV/Other, desc: "综艺TV Shows"}
    - {id: 4, cat: TV/Documentary, desc: "纪录片Documentaries"}
    - {id: 5, cat: TV/Anime, desc: "动漫Animations"}
    - {id: 6, cat: Audio/Video, desc: "音乐视频Music Videos"}
    - {id: 7, cat: TV/Sport, desc: "体育Sports"}
    - {id: 8, cat: Audio, desc: "音乐Music"}
    - {id: 9, cat: Books, desc: "电子书Ebook"}
    - {id: 10, cat: PC, desc: "软件Software"}
    - {id: 11, cat: Console, desc: "游戏Game"}
    - {id: 12, cat: Other, desc: "资料Education"}
    - {id: 13, cat: Other, desc: "旅游Travel"}
    - {id: 14, cat: Other, desc: "美食Food"}
    - {id: 15, cat: Other/Misc, desc: "其他Misc"}

  modes:
    search: [q]
    tv-search: [q, season, ep, imdbid]
    movie-search: [q, imdbid]
    music-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: info_tpp
    type: info
    label: Results Per Page
    default: For best results, change the <b>Torrents per page:</b> setting to <b>100</b> on your account profile.
  - name: sort
    type: select
    label: Sort requested from site
    default: added
    options:
      added: 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: takelogin.php
  method: post
  inputs:
    username: "{{ .Config.username }}"
    password: "{{ .Config.password }}"
    logout: ""
    securelogin: ""
    ssl: yes
    trackerssl: yes
  error:
    - selector: td.embedded:has(h2:contains("失败"))
    - selector: td.embedded:has(h2:contains("failed!"))
  test:
    path: index.php
    selector: a[href="/Users.logout"]

search:
  paths:
    - path: Torrents.tableList
      method: post
      response:
        type: json

  keywordsfilters:
    - name: re_replace
      args: ["[\\s]+", "%"]

  inputs:
    searchParams: "{\"sp_state\":\"{{ if .Config.freeleech }}2{{ else }}{{ end }}\",\"keyword\":\"{{ if .Query.IMDBID }}{{ .Query.IMDBID }}{{ else }}{{ .Keywords }}{{ end }}\",\"keyword_area\":\"{{ if .Query.IMDBID }}4{{ else }}1{{ end }}\"}"
    page: 1
    limit: 100
    field: "{{ .Config.sort }}"
    order: "{{ .Config.type }}"
    # json results does not have imdblink, and does not support multi cat filtering, defaulting to ALL.

  rows:
    selector: data.items
    count:
      selector: data.total

  fields:
    category:
      selector: category
    source:
      selector: source
      case:
        0: ""
        1: CN
        2: EU/US
        3: HK/TW
        4: JP
        5: KR
        6: Other
    medium:
      selector: medium
      case:
        0: ""
        1: "UHD Blu-ray"
        2: "Blu-ray"
        3: "Remux"
        4: "WEB-DL"
        5: "Encode"
        6: "HDTV"
        7: "DVD"
        8: "CD"
        9: "MiniBD"
    codec:
      selector: codec
      case:
        0: ""
        1: "H.265(HEVC)"
        2: "H.264"
        3: "VC-1"
        4: "Xvid"
        5: "MPEG-2"
        7: "MPEG-4"
        6: "Other"
    audiocodec:
      selector: audiocodec
      case:
        0: ""
        1: "DTS:X 7.1"
        2: "DTS-HD"
        3: "TrueHD Atmos"
        4: "TrueHD"
        5: "DTS"
        6: "LPCM"
        7: "FLAC"
        8: "WAV"
        9: "APE"
        10: "AAC"
        11: "AC3"
        12: "OGG"
        13: "MPEG"
        14: "Other"
    standard:
      selector: standard
      case:
        0: ""
        1: "8K"
        2: "2160p"
        3: "1080p"
        4: "1080i"
        5: "720p"
        6: "SD"
    title:
      selector: name
    details:
      selector: details
    download:
      selector: download
    description:
      selector: small_descr
      filters:
        - name: append
          args: " [{{ .Result.medium }} {{ .Result.standard }} {{ .Result.codec }} {{ .Result.audiocodec }} {{ .Result.source }}]"
    poster:
      selector: poster
    seeders:
      selector: seeders
    leechers:
      selector: leechers
    grabs:
      selector: times_completed
    date:
      # 2021-10-17 14:33:53
      selector: added
      filters:
        - name: append
          args: " +08:00" # CST
        - name: dateparse
          args: "2006-01-02 15:04:05 -07:00"
    size:
      selector: ..size
    downloadvolumefactor:
      selector: sp_state
      case:
        2: 0   # free
        4: 0   # 2x free
        5: 0.5 # 50% free
        6: 0.5 # 2x 50% free
        7: 0.3 # 30% free
        "*": 1
    uploadvolumefactor:
      selector: sp_state
      case:
        3: 2 # 2x
        4: 2 # 2x free
        6: 2 # 2x 50% free
        "*": 1
    minimumratio:
      text: 1.0
    minimumseedtime:
      # 2 day (as seconds = 2 x 24 x 60 x 60)
      text: 172800
# json NexusPHP v1.5 beta 5 20120707
