---
id: pttime
name: PTTime
description: "PTTime is a ratioless CHINESE Private Torrent Tracker for HD MOVIES / TV / GENERAL"
language: zh-CN
type: private
encoding: UTF-8
requestDelay: 5
links:
  - https://www.pttime.org/

caps:
  # dont forget to update the path categories in the search block
  categorymappings:
    - {id: 401, cat: Movies, desc: "Movies(电影)", default: true}
    - {id: 402, cat: TV, desc: "TV Series(电视剧)", default: true}
    - {id: 403, cat: TV, desc: "TV Shows(综艺)", default: true}
    - {id: 404, cat: TV/Documentary, desc: "Documentaries(纪录片)", default: true}
    - {id: 405, cat: TV/Sport, desc: "Sport(体育、竞技、武术及相关)", default: true}
    - {id: 406, cat: PC/Games, desc: "Games(游戏及相关)", default: true}
    - {id: 408, cat: Audio, desc: "Music(音乐、专辑、MV、演唱会)", default: true}
    - {id: 409, cat: Other, desc: "Art(舞蹈、歌剧、戏曲、相声、评书等)", default: true}
    - {id: 411, cat: Other, desc: "Science(科学、知识、技能)", default: true}
    - {id: 412, cat: Other, desc: "School(应试、考级、初中以上教育)", default: true}
    - {id: 420, cat: PC, desc: "Code(IT、编程、大数据、人工智能", default: true}
    - {id: 430, cat: TV/Anime, desc: "Animate(3D动画、2.5次元)", default: true}
    - {id: 432, cat: TV/Other, desc: "Baby(婴幼、早教、小学及相关)", default: true}
    - {id: 450, cat: Other, desc: "Resource(资源、素材、模板)", default: true}
    - {id: 451, cat: PC, desc: "Software(软件、系统、 程序、APP等)", default: true}
    - {id: 490, cat: Other, desc: "Other(其它)", default: true}
    - {id: 440, cat: XXX, desc: "9kg-AV(步兵/无码)", default: false}
    - {id: 441, cat: XXX, desc: "9kg-Sex(骑兵/有码)", default: false}
    - {id: 442, cat: XXX, desc: "9kg-III(三级片、限制级电影)", default: false}
    - {id: 443, cat: XXX, desc: "9kg-H动漫", default: false}
    - {id: 444, cat: XXX, desc: "9kg-H游戏", default: false}
    - {id: 445, cat: XXX, desc: "9kg-H书籍(书籍、有声书)", default: false}
    - {id: 446, cat: XXX, desc: "9kg-H写真(图片、私拍、短视频）", default: false}
    - {id: 447, cat: XXX, desc: "9kg-H音频(ASMR、音乐、音频)", default: false}
    - {id: 448, cat: XXX, desc: "9kg-H综(综艺、综合、剪辑、其他等)", default: false}
    - {id: 449, cat: XXX, desc: "9kg-H同(男同、女同、人妖)", default: false}

  modes:
    search: [q]
    tv-search: [q, season, ep, imdbid, doubanid]
    movie-search: [q, imdbid, doubanid]
    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: sort
    type: select
    label: Sort requested from site
    default: 4
    options:
      4: created
      7: seeders
      5: size
      1: title
  - name: type
    type: select
    label: Order requested from site
    default: desc
    options:
      desc: desc
      asc: asc
  - 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: info_activity
    type: info
    label: Account Inactivity
    default: "Account retention rules:<ol><li>Veteran User and above will be retained forever</li><li>Elite User and above will not have their account deleted after parking (in the control panel).</li><li>Users with a parked account will be deleted if they do not log in for 400 consecutive days</li><li>Users with a non-parked account will be deleted if they do not log in for 150 consecutive days</li><li>Users who have no traffic (i.e. upload/download data are both 0) will be deleted if they do not log in for 100 consecutive days.</li></ol>"

login:
  path: takelogin.php
  method: post
  inputs:
    loginmethod: username
    username: "{{ .Config.username }}"
    password: "{{ .Config.password }}"
    dutime: month
    ssl: yes
  error:
    - selector: td.embedded:has(h2:contains("失败"))
  test:
    path: index.php
    selector: a[href="logout.php"]

search:
  paths:
    - path: torrents.php
      categories: [401, 402, 403, 404, 405, 406, 408, 409, 411, 412, 420, 430, 432, 450, 451, 490]
    - path: adults.php
      categories: [440, 441, 442, 443, 444, 445, 446, 447, 448, 449]
  inputs:
    $raw: "{{ range .Categories }}cat{{.}}=1&{{end}}"
    # currently supports only one query id at one time.
    search: "{{ if .Query.IMDBID }}{{ .Query.IMDBID }}{{ else }}{{ end }}{{ if or .Query.IMDBID .Query.DoubanID }} {{ else }}{{ .Keywords }}{{ end }}{{ if .Query.DoubanID }}{{ .Query.DoubanID }}{{ else }}{{ 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%, 8 neutral
    spstate: "{{ if .Config.freeleech }}2{{ else }}0{{ end }}"
    # 1 title&subtitle, 2 titleonly, 3 descr
    search_area: "{{ if or .Query.IMDBID .Query.DoubanID }}3{{ else }}2{{ end }}"
    sort: "{{ .Config.sort }}"
    type: "{{ .Config.type }}"
    notnewword: 1

  rows:
    selector: table.torrents > tbody > tr:has(a[href^="download.php?id="])

  fields:
    category:
      selector: a[href^="?cat="]
      attribute: href
      filters:
        - name: querystring
          args: cat
    title_default:
      selector: a[href^="details.php?id="]
    title:
      selector: a[title][href^="details.php?id="]
      attribute: title
      optional: true
      default: "{{ .Result.title_default }}"
    details:
      selector: a[href^="details.php?id="]
      attribute: href
    download:
      selector: a[href^="download.php?id="]
      attribute: href
    poster:
      selector: td.torrentimg > img
      attribute: src
    imdbid:
      selector: a[href*="imdb.com/title/tt"]
      attribute: href
    doubanid:
      selector: a[href*="movie.douban.com/subject/"]
      attribute: href
    date_elapsed:
      # time type: time elapsed (default)
      selector: td:nth-child(5) > span[title]
      attribute: title
      optional: true
      filters:
        - name: append
          args: " +08:00" # CST
        - name: dateparse
          args: "yyyy-MM-dd HH:mm:ss zzz"
    date_added:
      # time added
      selector: td:nth-child(5):not(:has(span))
      optional: true
      filters:
        - name: append
          args: " +08:00" # CST
        - name: dateparse
          args: "yyyy-MM-ddHH:mm:ss zzz"
    date:
      text: "{{ if or .Result.date_elapsed .Result.date_added }}{{ or .Result.date_elapsed .Result.date_added }}{{ else }}now{{ end }}"
    size:
      selector: td:nth-child(6)
    seeders:
      selector: td:nth-child(7)
    leechers:
      selector: td:nth-child(8)
    grabs:
      selector: td:nth-child(9)
    downloadvolumefactor:
      case:
        font.promotion.free: 0
        font.promotion.twoupfree: 0
        font.promotion.halfdown: 0.5
        font.promotion.twouphalfdown: 0.5
        font.promotion.thirtypercent: 0.3
        "*": 1
    uploadvolumefactor:
      case:
        font.promotion.twoup: 2
        font.promotion.twoupfree: 2
        font.promotion.twouphalfdown: 2
        "*": 1
    description:
      selector: td:nth-child(2) > font:last-child
# NexusPHP Standard v1.5 Beta 4 (custom)
