---
id: hdc
name: HDCiTY
description: "HDCiTY (HDC) is a CHINESE Private Torrent Tracker for HD MOVIES / TV / GENERAL"
language: zh-CN
type: private
encoding: UTF-8
links:
  - https://hdcity.city/
  - https://hdcity.work/
  - https://hdcity.leniter.org/
  - https://hdcity4.leniter.org/

caps:
  categorymappings:
    - {id: 401, cat: Movies, desc: "Movies/电影"}
    - {id: 402, cat: TV, desc: "Series/剧集"}
    - {id: 404, cat: TV/Documentary, desc: "Doc/档案记录"}
    - {id: 405, cat: TV/Anime, desc: "Anim/动漫"}
    - {id: 403, cat: TV, desc: "Shows/节目"}
    - {id: 406, cat: Audio/Video, desc: "MV/音乐视频"}
    - {id: 407, cat: TV/Sport, desc: "Sports/体育"}
    - {id: 408, cat: Audio, desc: "Audio/音频"}
    - {id: 727, cat: XXX, desc: "XXX/家长指引"}
    - {id: 728, cat: Other, desc: "Edu/文档/教材"}
    - {id: 729, cat: PC, desc: "Soft/软件"}
    - {id: 409, cat: Other, desc: "Other/其他"}

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

settings:
  # not entirely sure why cookie method is being used. while the login page uses non-standard field names, the form seems regular enough.
  # but since none of the team have an account we cannot switch to using form method without having any testing validation.
  - name: cookie
    type: text
    label: Cookie
  - name: info_cookie
    type: info_cookie
  - name: freeleech
    type: checkbox
    label: Search freeleech only
    default: false
  - name: sort
    type: select
    label: Sort requested from site
    default: 4
    options:
      4: created
      7: seeders
      5: size
  - name: type
    type: select
    label: Order requested from site
    default: desc
    options:
      desc: desc
      asc: asc
  - name: info_Results
    type: info
    label: Settings for Results
    default: "To use this indexer please set the following on your HDC account <b>profile</b>:<ul><li><i>Site Language:</i><b> English</b></li><li><i>Torrent List Profile:</i> <b>Default Modern [preview]</b></li><li><i>Time Type: </i><b>Time Added</b></li><li><i>Torrents per page:</i><b> 100</b></li></ul>"

login:
  method: cookie
  inputs:
    cookie: "{{ .Config.cookie }}"
  test:
    path: pt
    selector: a[href^="logout?key="]

search:
  paths:
    # https://hdcity.city/pt?incldead=0&spstate=0&inclbookmarked=0&iwannaseethis=shanghai+triad&search_area=0&search_mode=0
    # https://hdcity.city/pt?incldead=0&spstate=0&inclbookmarked=0&iwannaseethis=115012&search_area=4&search_mode=0
    - path: pt
  inputs:
    $raw: "{{ range .Categories }}cat{{.}}=1&{{end}}"
    iwannaseethis: "{{ if .Query.IMDBID }}{{ .Query.IMDBIDShort }}{{ else }}{{ .Keywords }}{{ end }}"
    # 0 incldead, 1 active, 2 dead
    incldead: 0
    # 0 all, 1 normal, 2 free, 3 2x, 4 2xfree, 5 50%, 6 2x50%, 7 30%
    spstate: "{{ if .Config.freeleech }}2{{ else }}0{{ end }}"
    # 0 title, 1 descr, 3 uploader, 4 imdb number
    search_area: "{{ if .Query.IMDBID }}4{{ else }}0{{ end }}"
    # 0 AND, 1 OR, 2 exact
    search_mode: 0
    sort: "{{ .Config.sort }}"
    type: "{{ .Config.type }}"
    notnewword: 1

  rows:
    selector: div.trblock

  fields:
    title:
      selector: div.trtop a[href^="t-"]
    category:
      selector: div.trm
      attribute: style
      filters:
        - name: regexp
          args: (\d+)
    details:
      selector: div.trtop a[href^="t-"]
      attribute: href
    download:
      selector: a[href^="download?id="]
      attribute: href
    poster:
      selector: div.trp:not(:has(img[src$="poster.jpg"])) img
      attribute: src
    imdbid:
      selector: a[href*="imdb.com/title/tt"]
      attribute: href
    size:
      selector: div.trbo div:nth-last-child(8)
      remove: i
    seeders:
      selector: div.trbo div:nth-last-child(7)
      optional: true
      default: 0
      filters:
        - name: re_replace
          args: ["\\s", "0"]
    leechers:
      selector: div.trbo div:nth-last-child(6)
      optional: true
      default: 0
      filters:
        - name: re_replace
          args: ["\\s", "0"]
    grabs:
      selector: div.trbo div:nth-last-child(5)
      optional: true
      default: 0
      filters:
        - name: re_replace
          args: ["\\s", "0"]
    date:
      remove: a, span
      selector: div[style="float:right;"]
      filters:
        - name: replace
          args: ["@", ""]
        - name: append
          args: " +08:00" # CST
        - name: dateparse
          args: "yyyy-MM-dd HH:mm:ss zzz"
    downloadvolumefactor:
      case:
        img.pro_free: 0
        img.pro_free2up: 0
        img.pro_50pctdown: 0.5
        img.pro_50pctdown2up: 0.5
        img.pro_30pctdown: 0.3
        "*": 1
    uploadvolumefactor:
      case:
        img.pro_50pctdown2up: 2
        img.pro_free2up: 2
        img.pro_2up: 2
        "*": 1
# engine n/a (likely based on NexusPHP)
