---
id: fsm
name: FSM
description: "FSM is a CHINESE Private Torrent Tracker for 3X"
language: zh-CN
type: private
encoding: UTF-8
requestDelay: 4
links:
  - https://fsm.name/

caps:
  categorymappings:
    - {id: 1, cat: XXX, desc: "日本AV"}
    - {id: 2, cat: XXX, desc: "国产视频"}
    - {id: 3, cat: XXX/ImageSet, desc: "写真"}
    - {id: 4, cat: XXX/Other, desc: "黄油"}
    - {id: 5, cat: XXX, desc: "里番"}
    - {id: 6, cat: XXX/Other, desc: "黄色漫画"}
    - {id: 7, cat: XXX, desc: "欧美视频"}
    - {id: 8, cat: XXX, desc: "其他"}

  modes:
    search: [q]

settings:
  - name: apitoken
    type: text
    label: API Token
  - name: info_token
    type: info
    label: About your API Token
    default: "Generate your API token on the <a href=\"https://fsm.name/API\" target=\"_blank\">FSM API</a> page."
  - name: passkey
    type: text
    label: Passkey
  - name: info_passkey
    type: info
    label: About your Passkey
    default: "Find your Passkey on the <a href=\"https://fsm.name/Rss\" target=\"_blank\">FSM RSS</a> page."
  - name: freeleech
    type: checkbox
    label: Search freeleech only
    default: false
  - name: info_activity
    type: info
    label: Account Inactivity
    default: "To be on the safe side, you need to complete a new torrent every 60 days (either seed after publishing the torrent or download a torrent entirely), otherwise, your account will be locked and can be unlocked via the password recovery feature on the login page."

login:
  path: https://api.fsm.name/Torrents/listTorrents
  method: get
  inputs: {} # TODO: remove in v10

search:
  paths:
    - path: https://api.fsm.name/Torrents/listTorrents
      response:
        type: json

  headers:
    APITOKEN: ["{{ .Config.apitoken }}"]

  inputs:
    type: 0
    keyword: "{{ .Keywords }}"
    # 0 all, 1 2xfree, 2 free
    systematics: "{{ if .Config.freeleech }}2{{ else }}0{{ end }}"

  rows:
    selector: data.list

  fields:
    category:
      selector: type.id
    title:
      selector: title
    _id:
      selector: tid
    details:
      text: "{{ .Config.sitelink }}Torrents/details?tid={{ .Result._id }}"
    download:
      text: "/Torrents/download?tid={{ .Result._id }}&passkey={{ .Config.passkey }}"
    infohash:
      selector: fileHash
    poster:
      selector: cover
    genre:
      selector: tags
    description:
      text: "{{ .Result.genre }}"
    seeders:
      selector: peers.upload
    leechers:
      selector: peers.download
    grabs:
      selector: finish
    date:
      selector: createdTs
    size:
      selector: fileSize
    downloadvolumefactor:
      selector: status.downCoefficient
    uploadvolumefactor:
      selector: status.upCoefficient
    minimumratio:
      text: 1.0
# json TNode
