---
  site: shareisland
  name: Shareisland
  description: "A general italian tracker"
  language: it-it
  type: private
  encoding: UTF-8
  links:
    - https://shareisland.org/
  legacylinks:
    - http://shareisland.org/  
    - http://www.shareisland.org/

  caps:
    categorymappings:
      # Vip
       - {id: 34, cat: XXX, desc: "Adulti"}
       - {id: 46, cat: Other, desc: "IPTV"}
       - {id: 57, cat: XXX, desc: "Riviste XXX"}
       - {id: 58, cat: XXX, desc: "Fumetti XXX"}
      # Applicazioni
       - {id: 33, cat: PC/Phone-Android, desc: "Android"}
       - {id: 8, cat: PC/0day, desc: "Linux"}
       - {id: 9, cat: PC/Mac, desc: "Mac"}
       - {id: 7, cat: PC/0day, desc: "PC"}
      # Books
       - {id: 43, cat: Books, desc: "Libreria"}
       - {id: 41, cat: Books, desc: "Quotidiani"}
       - {id: 59, cat: Books, desc: "Fumetti"}
       - {id: 60, cat: Books, desc: "Riviste"}
       - {id: 61, cat: Books, desc: "Audiolibri"}
      # Games
       - {id: 47, cat: PC/Games, desc: "Games PC"}
       - {id: 40, cat: Console/Other, desc: "Nintendo"}
       - {id: 13, cat: Console/PS4, desc: "Sony PS"}
       - {id: 33, cat: Console/Xbox, desc: "XboX"}
       - {id: 14, cat: Console/Wii, desc: "Wii"}
      # Music
       - {id: 54, cat: Audio/MP3, desc: "MP3"}
       - {id: 55, cat: Audio/Lossless, desc: "Flac"}
      # Movies
       - {id: 17, cat: Movies/SD, desc: "Cine News"}
       - {id: 43, cat: Movies/SD, desc: "BDRip"}
       - {id: 16, cat: Movies/SD, desc: "DivX"}
       - {id: 20, cat: Movies/SD, desc: "DVDRip"}
       - {id: 21, cat: Movies/DVD, desc: "DVD"}
       - {id: 25, cat: Movies/HD, desc: "720p"}
       - {id: 24, cat: Movies/HD, desc: "1080p"}
       - {id: 27, cat: Movies/BluRay, desc: "Blu Ray Disk"}
       - {id: 23, cat: Movies/HD, desc: "H-265"}
       - {id: 26, cat: Movies/3D, desc: "3D-FullHD"}
       - {id: 31, cat: TV/SD, desc: "SerieTV"}
       - {id: 45, cat: TV/HD, desc: "Serie Tv HD"}
       - {id: 22, cat: Movies/UHD, desc: "4K-Ultra-HD"}
       - {id: 49, cat: TV/Documentary, desc: "Documentari"}
       - {id: 50, cat: TV/Other, desc: "Programmi TV"}
       - {id: 51, cat: Movies/Other, desc: "Mp4"}

       - {id: 5, cat: TV/Anime, desc: "Anime"}

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

  login:
    path: /index.php?page=login
    method: post
    inputs:
      uid: "{{ .Config.username }}"
      pwd: "{{ .Config.password }}"
    error:
      - selector: div.error
    test:
      path: /index.php
      selector: a[href="logout.php"]

  search:
    paths:
      - path: /index.php
    keywordsfilters:
      - name: re_replace
        args: ["S[0-9]{2}([^E]|$)", ""] # remove season tag without episode (search doesn't support it)
      - name: diacritics
        args: replace
      # most ITA TV torrents are in XXxYY format, so we search without S/E prefixes and filter later
      - name: re_replace
        args: ["S0?(\\d{1,2})", " $1 "]
      - name: re_replace
        args: ["E(\\d{2,3})", " $1 "]
    inputs:
      search: "{{ .Keywords }}"
      category: "{{range .Categories}}{{.}};{{end}}"
      page: torrents
      active: 0
    rows:
      selector: div.b-content > table > tbody > tr > td > table.lista > tbody > tr:has(a[href^="index.php?page=torrents&category="])
    fields:
      download:
        selector: a[href^="download.php?id="]
        attribute: href
      title: # shortened title?
        selector: a[href^="index.php?page=torrent-details"]
        # normalize to SXXEYY format
        filters:
          - name: re_replace # replace special characters with " " (space)
            args: ["[^a-zA-Z0-9]|\\.", " "]
          # normalize to SXXEYY format
          - name: re_replace
            args: ["(\\d{2})x(\\d{2})", "S$1E$2"]
          - name: re_replace
            args: ["(\\d{1})x(\\d{2})", "S0$1E$2"]
          - name: re_replace #Stagione X --> S0X
            args: ["Stagione (\\d{0,1}\\s)", "S0$1"]
          - name: re_replace #Stagione XX --> SXX
            args: ["Stagione (\\d{2}\\s)", "S$1"]
          - name: re_replace #/ Episodio [YY-YY --> EYY-YY
            args: ["(\\s\\/\\sEpisodio|\\s\\/\\sEpisodi|\\sEpisodio|\\s\\|\\sEpisodio|\\sEpisodi)\\s\\[", "E"]
          - name: re_replace #/ Completa [episodi  YY-YY --> EYY-YY
            args: ["(\\s\\/\\sCompleta\\s\\[episodi\\s)", "E"]
          - name: re_replace #remove  di YY] | remove /YY]
            args: ["(\\sdi\\s\\d{1,2}|\\/\\d{1,2})\\]", " "]
          - name: re_replace #remove various
            args: ["(Serie completa|Completa|\\[in pausa\\])", ""]
          # fine prova
      title: # long titles?
        optional: true
        selector: a[title][href^="index.php?page=torrent-details"]
        attribute: title
        filters:
          - name: replace
            args: ["Vedi Dettagli: ", ""]
          # inizio prova
          - name: re_replace # replace special characters with " " (space)
            args: ["[^a-zA-Z0-9]|\\.", " "]
          # normalize to SXXEYY format
          - name: re_replace
            args: ["(\\d{2})x(\\d{2})", "S$1E$2"]
          - name: re_replace
            args: ["(\\d{1})x(\\d{2})", "S0$1E$2"]
          - name: re_replace #Stagione X --> S0X
            args: ["Stagione (\\d{0,1}\\s)", "S0$1"]
          - name: re_replace #Stagione XX --> SXX
            args: ["Stagione (\\d{2}\\s)", "S$1"]
          - name: re_replace #/ Episodio [YY-YY --> EYY-YY
            args: ["(\\s\\/\\sEpisodio|\\s\\/\\sEpisodi|\\sEpisodio|\\s\\|\\sEpisodio|\\sEpisodi)\\s\\[", "E"]
          - name: re_replace #/ Completa [episodi  YY-YY --> EYY-YY
            args: ["(\\s\\/\\sCompleta\\s\\[episodi\\s)", "E"]
          - name: re_replace #remove  di YY] | remove /YY]
            args: ["(\\sdi\\s\\d{1,2}|\\/\\d{1,2})\\]", " "]
          - name: re_replace #remove various
            args: ["(Serie completa|Completa|\\[in pausa\\])", ""]
          # fine prova
      category:
        selector: a[href^="index.php?page=torrents&category="]
        attribute: href
        filters:
          - name: querystring
            args: category
      details:
        selector: a[href^="index.php?page=torrent-details&id="]
        attribute: href
      banner:
        optional: true
        selector: a[href^="index.php?page=torrent-details&id="][onmouseover]
        attribute: onmouseover
        filters:
          - name: regexp
            args: "src=(.+?) "
      size:
        selector: td:nth-child(10)
      date:
        selector: td:nth-child(5)
        filters:
          - name: dateparse
            args: "02/01/2006"
      grabs:
        selector: td:nth-child(8)
        filters:
          - name: replace
            args: ["---", "0"]
      seeders:
        selector: td:nth-child(6)
      leechers:
        selector: td:nth-child(7)
      downloadvolumefactor:
        case:
          img[alt="Free Leech"]: "0"
          img[alt="Gold 100% Free"]: "0"
          img[alt="Silver 50% Free"]: "0.5"
          img[alt="Bronze 25% Free"]: "0.75"
          "*": "1"
      uploadvolumefactor:
        text: "1"
      uploadvolumefactor:
        optional: true
        selector: img[alt$="x Upload Multiplier"]
        attribute: alt
        filters:
          - name: replace
            args: ["x Upload Multiplier", ""]
