---
id: sharewood-api
replaces:
  - sharewoodapi
name: Sharewood (API)
description: "sharewood is a FRENCH Semi-Private Torrent Tracker for GENERAL"
language: fr-FR
type: semi-private
encoding: UTF-8
requestDelay: 2.1
links:
  - https://www.sharewood.tv/

caps:
  categorymappings:
    # categories
#    - {id: 1, cat: Movies, desc: "Vidéo"}
#    - {id: 1, cat: TV, desc: "Vidéo"}
#    - {id: 2, cat: Audio, desc: "Audio"}
#    - {id: 3, cat: PC, desc: "Application"}
#    - {id: 4, cat: Books/EBook, desc: "Ebooks"}
#    - {id: 5, cat: PC/Games, desc: "Jeu-Vidéo"}
#    - {id: 6, cat: Other, desc: "Formation"}
#    - {id: 7, cat: XXX, desc: "XXX"}

    # subcategories
    - {id: 9, cat: Movies, desc: "Films"}
    - {id: 10, cat: TV, desc: "Séries"}
    - {id: 11, cat: Movies/Other, desc: "Films Animations"}
    - {id: 12, cat: TV/Anime, desc: "Séries Animations"}
    - {id: 13, cat: TV/Documentary, desc: "Documentaires"}
    - {id: 14, cat: TV/Other, desc: "Emissions TV"}
    - {id: 15, cat: TV/Other, desc: "Spectacles/Concerts"}
    - {id: 16, cat: TV/Sport, desc: "Sports"}
    - {id: 17, cat: Audio/Video, desc: "Karaoké Vidéo"}
    - {id: 18, cat: Audio/Other, desc: "Karaoké"}
    - {id: 20, cat: Audio, desc: "Musiques"}
    - {id: 21, cat: Audio/Other, desc: "Podcasts"}
    - {id: 22, cat: Audio/Other, desc: "Samples"}
    - {id: 23, cat: Audio/Audiobook, desc: "Ebooks Audio"}
    - {id: 24, cat: Books/EBook, desc: "BDs"}
    - {id: 25, cat: Books/Comics, desc: "Comics"}
    - {id: 26, cat: Books/Other, desc: "Mangas"}
    - {id: 27, cat: Books, desc: "Livres"}
    - {id: 28, cat: Books/Mags, desc: "Presse"}
    - {id: 29, cat: PC, desc: "Applications Linux"}
    - {id: 30, cat: PC/0day, desc: "Applications Windows"}
    - {id: 31, cat: PC/Mac, desc: "Applications Mac"}
    - {id: 34, cat: PC/Mobile-iOS, desc: "Applications Smartphone/Tablette"}
    - {id: 34, cat: PC/Mobile-Android, desc: "Applications Smartphone/Tablette"}
    - {id: 35, cat: PC/Mobile-Other, desc: "GPS"}
    - {id: 36, cat: PC/Games, desc: "Jeux Linux"}
    - {id: 37, cat: PC/Games, desc: "Jeux Windows"}
    - {id: 38, cat: PC/Mac, desc: "Jeux Mac"}
    - {id: 39, cat: Console/NDS, desc: "Jeux Nintendo"}
    - {id: 39, cat: Console/Wii, desc: "Jeux Nintendo"}
    - {id: 39, cat: Console/Wiiware, desc: "Jeux Nintendo"}
    - {id: 39, cat: Console/3DS, desc: "Jeux Nintendo"}
    - {id: 39, cat: Console/WiiU, desc: "Jeux Nintendo"}
    - {id: 40, cat: Console/PS4, desc: "Jeux Sony"}
    - {id: 41, cat: PC/Mobile-Android, desc: "Jeux Smartphone/Tablette"}
    - {id: 42, cat: PC/Games, desc: "Jeux Microsoft"}
    - {id: 43, cat: Other, desc: "Rétrogaming & Emulation"}
    - {id: 44, cat: XXX, desc: "Films XXX"}
    - {id: 45, cat: XXX/Other, desc: "XXX Hentai"}
    - {id: 47, cat: XXX/ImageSet, desc: "XXX Images"}
    - {id: 48, cat: XXX/Other, desc: "XXX Jeux-Vidéo"}
    - {id: 49, cat: Other/Misc, desc: "Formations Vidéos"}
    - {id: 50, cat: Other/Misc, desc: "Formations Logiciels"}
    - {id: 51, cat: XXX/Other, desc: "XXX Ebooks"}
    - {id: 52, cat: Audio/Video, desc: "Vidéos-Clips"}

  modes:
    search: [q]
    tv-search: [q, season, ep]
    movie-search: [q]
    music-search: [q]
    book-search: [q]
  allowrawsearch: true

settings:
  - name: passkey
    type: text
    label: Passkey
  - name: info_passkey
    type: info
    label: About your Passkey
    default: "Find your Passkey by accessing your <a href=\"https://www.sharewood.tv/\" target=\"_blank\">Sharewood</a> profile on the <i>My Profile</i> page and scrolling down to the <b>Passkey</b> field."
  - name: freeleech
    type: checkbox
    label: Search freeleech only
    default: false
  - name: multilang
    type: checkbox
    label: Replace MULTi by another language in release name
    default: false
  - name: multilanguage
    type: select
    label: Replace MULTi by this language
    default: FRENCH
    options:
      FRENCH: FRENCH
      MULTi FRENCH: MULTi FRENCH
      ENGLISH: ENGLISH
      MULTi ENGLISH: MULTi ENGLISH
      VOSTFR: VOSTFR
      MULTi VOSTFR: MULTi VOSTFR
  - name: vostfr
    type: checkbox
    label: Replace VOSTFR and SUBFRENCH with ENGLISH
    default: false

login:
  path: "api/{{ .Config.passkey }}/last-torrents"
  method: get
  error:
    - selector: ":root:contains(\"Invalid passkey\")"
    - selector: ":root:contains(\"La page demandée est introuvable\")" # 404 page on empty passkey
    - selector: ":root:contains(\"Passkey invalide\")"
    - selector: ":root:contains(\"503 Service Temporarily Unavailable\")"

search:
  paths:
    - path: "api/{{ .Config.passkey }}/{{ if .Keywords }}search{{ else }}last-torrents{{ end }}"
      response:
        type: json

  inputs:
    subcategory: "{{ join .Categories \",\" }}"
    name: "{{ .Keywords }}"
    limit: 50
    free: "{{ if .Config.freeleech }}1{{ else }}{{ end }}"

  keywordsfilters:
    - name: re_replace
      args: ["[^\\w]+", " "]

  rows:
    selector: $

  fields:
    _id:
      selector: id
    category:
      selector: subcategory_id
    title_phase1:
      selector: name
    title_vostfr:
      text: "{{ .Result.title_phase1 }}"
      filters:
        - name: re_replace
          args: ["(?i)\\b(vostfr|subfrench)\\b", "ENGLISH"]
    title_phase2:
      text: "{{ if .Config.vostfr }}{{ .Result.title_vostfr }}{{ else }}{{ .Result.title_phase1 }}{{ end }}"
    title_multilang:
      text: "{{ .Result.title_phase2 }}"
      filters:
        - name: re_replace
          args: ["(?i)\\b(MULTI(?!.*(?:FRENCH|ENGLISH|VOSTFR)))\\b", "{{ .Config.multilanguage }}"]
    title:
      text: "{{ if .Config.multilang }}{{ .Result.title_multilang }}{{ else }}{{ .Result.title_phase2 }}{{ end }}"
    details:
      selector: slug
      filters:
        - name: prepend
          args: "/torrents/"
        - name: append
          args: ".{{ .Result._id }}"
    download:
      selector: download_url
    size:
      selector: size
    seeders:
      selector: seeders
    leechers:
      selector: leechers
    grabs:
      selector: times_completed
    date:
      selector: created_at
      filters:
        - name: append
          args: " +00:00" # GMT
        - name: dateparse
          args: "yyyy-MM-dd HH:mm:ss zzz"
    downloadvolumefactor:
      # api returns 0=false, 1=true
      selector: free
      case:
        0: 1 # not free
        1: 0 # freeleech
    uploadvolumefactor:
      # api returns 0=false, 1=true
      selector: doubleup
      case:
        0: 1 # normal
        1: 2 # double
    minimumratio:
      text: 0.75
    minimumseedtime:
      # 7 days (as seconds = 7 x 24 x 60 x 60)
      text: 604800
# json UNIT3D v2.0
