---
  site: totheglory
  name: ToTheGlory
  description: "A chinese tracker"
  language: zh-cn
  type: private
  encoding: UTF-8
  links:
    - https://totheglory.im/

  caps:
    categories:
      # 电影
      电影DVDRip: Movies/SD # Movie DVDRip
      电影720p: Movies/HD # Movie 720p
      电影1080i/p: Movies/HD # Movie 1080i / p
      BluRay原盘: Movies/BluRay # BluRay original disc

      # 纪录片
      纪录片720p: Movies/HD # Documentary 720p
      纪录片1080i/p: Movies/HD # Documentary 1080i / p
      纪录片BluRay原盘: Movies/BluRay # Documentary BluRay Original

      # 剧集
      欧美剧720p: TV/HD # 欧美剧720p
      欧美剧1080i/p: TV/HD # 欧美剧1080i/p
      高清日剧: TV/HD # 高清日剧
      大陆港台剧1080i/p: TV/HD # 大陆港台剧1080i/p
      大陆港台剧720p: TV/HD # 大陆港台剧720p
      高清韩剧: TV/HD # 高清韩剧

      # 剧集包
      欧美剧包: TV/HD # 欧美剧包
      日剧包: TV/HD # 日剧包
      韩剧包: TV/HD # 韩剧包
      华语剧包: TV/HD # 华语剧包

      # 音乐
      (电影原声&Game)OST: Audio # (电影原声&Game)OST
      无损音乐FLAC&APE: Audio/Lossless  # 无损音乐FLAC&APE
      MV&amp;演唱会: Audio/Video # MV&演唱会

      # 其他
      高清体育节目: TV/Sport # High-definition sports programs
      高清动漫: TV/Anime # HD animation
      韩国综艺: TV/HD # South Korea Variety
      日本综艺: TV/HD # Japanese variety
      高清综艺: TV/HD # HD Variety
      MiniVideo: Other # MiniVideo
      补充音轨: Audio # Supplemental audio tracks
      iPhone/iPad视频: PC/Phone-Other # IPhone / iPad video

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

  login:
    path: /login.php?returnto=
    method: form
    inputs:
      username: "{{ .Config.username }}"
      password: "{{ .Config.password }}"
    error:
      - selector: form#loginform > span.warning
    test:
      path: /my.php

  ratio:
    path: /my.php
    selector: span.smallfont:has(span#sp_signed)
    filters:
      - name: regexp
        args: "分享率 : (.*?)\u00a0\u00a0"

  search:
    paths:
      - path: /browse.php
    inputs:
      search_field: "{{range .Categories}}分类:`{{.}}` {{end}}{{ .Query.Keywords }}"
      c: "M"
    rows:
      selector: table#torrent_table > tbody > tr[id]
    fields:
      description:
        selector: div.name_left > a > b
      title:
        selector: div.name_left > a > b
        remove: span
      category:
        selector: tr[id] td:nth-child(1) > a
        attribute: href
        filters:
          - name: querystring
            args: search_field
          - name: replace
            args: ["category:", ""]
          - name: trim
            args: "\""
      details:
        selector: div.name_left > a
        attribute: href
      download:
        selector: a.dl_a
        attribute: href
        filters:
          - name: regexp
            args: "^(/download.php/\\d+/).*" # cut off download url after ID to avoid bad request errors with curl
      files:
        selector: td:nth-child(3)
      size:
        selector: td:nth-child(7)
      seeders:
        selector: td:nth-child(9)
        filters:
          - name: split
            args: ["/", 0]
      leechers:
        selector: td:nth-child(9)
        filters:
          - name: split
            args: ["/", 1]
          - name: replace
            args: ["\n", ""]
      grabs:
        selector: td:nth-child(8)
        filters:
          - name: regexp
            args: "(\\d+)"
      date:
        selector: td:nth-child(5)
        filters:
          - name: append
            args: " +0800"
          - name: dateparse
            args: "2006-01-0215:04:05 -0700"
      imdb:
        selector: span.imdb_rate > a
        attribute: href
      downloadvolumefactor:
        case:
          img[alt="free"]: "0"
          img[alt="50%"]: "0.5"
          img[alt="30%"]: "0.3"
          "*": "1"
      uploadvolumefactor:
        case:
          "*": "1"