---
  site: megabliz
  name: Mega-Bliz
  description: "Mega-Bliz is a Semi-Private site for MOVIES / TV / GENERAL"
  language: en-us
  type: semi-private
  encoding: UTF-8
  links:
    - https://mega-bliz.nl/

  caps:
    categorymappings:
      - {id: 9, cat: TV/Anime, desc: "Anime"}
      - {id: 1, cat: PC/0day, desc: "Apps"}
      - {id: 13, cat: PC/0day, desc: "Apps"}
      - {id: 5, cat: TV, desc: "Episodes"}
      - {id: 2, cat: PC/Games, desc: "Games"}
      - {id: 12, cat: PC/Games, desc: "Games/PC Rips"}
      - {id: 8, cat: Console/Other, desc: "Games/PS2"}
      - {id: 7, cat: Console/PSP, desc: "Games/PSP"}
      - {id: 3, cat: Movies, desc: "Movies"}
      - {id: 11, cat: Movies/SD, desc: "Movies/HDTV"}
      - {id: 10, cat: Movies/SD, desc: "Movies/XviD"}
      - {id: 4, cat: Audio, desc: "Music"}
      - {id: 14, cat: Audio, desc: "Music"}
      - {id: 6, cat: XXX, desc: "XXX"}

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

  settings:
    - name: username
      type: text
      label: Username
    - name: password
      type: password
      label: Password
    - name: incldead
      type: select
      label: "Search Torrents that are:"
      default: "0"
      options:
        "0" : "Active"
        "1": "Including Dead"
        "2": "Only Dead"
    - name: onlyfree
      type: checkbox
      label: Show only Free torrents
      default: false
    - name: info
      type: info
      label: Results Per Page
      default: For best results, change the 'Torrents per page' setting to 100 on your 'Personal Options' from the 'Personal' menu on the Mega-Blitz webpage.

  login:
    path: login.php
    method: form
    form: form[action="takelogin.php"]
    inputs:
      username: "{{ .Config.username }}"
      password: "{{ .Config.password }}"
      submitme: "X"
    error:
      - selector: h2
        message:
          selector: table tr td.text
    test:
      path: browse.php
      selector: a[href*="logout.php?hash_please="]

  search:
    paths:
      - path: browse.php      
    inputs:
      $raw: "{{range .Categories}}c{{.}}=1&{{end}}"
      search: "{{ .Keywords }}"
      searchin: "title"
      incldead: "{{ .Config.incldead }}"
      "only_free": "{{ if .Config.onlyfree }}1{{else}}0{{end}}"

    rows:
      selector: tr.browse_color
      filters:
        - name: andmatch
    fields:
      category:
        selector: td:nth-of-type(1) a
        attribute: href
        filters:
          - name: querystring
            args: cat
      title:
        selector: td:nth-of-type(2) a
        attribute: onmouseover
        filters:
          - name: split
            args: [">", "1"]
          - name: replace
            args: ["</b", ""]
      details:
        selector: td:nth-of-type(2) a
        attribute: href
      download:
        selector: td:nth-of-type(3) a
        attribute: href
      files:
        selector: td:nth-of-type(5)
      date:
        selector: td:nth-of-type(7)
        filters:
          - name: dateparse
            args: "Jan 02 2006 03:04 PM"
      size:
        selector: td:nth-of-type(8)
      grabs:
        selector: td:nth-of-type(9) a
        filters:
          - name: regexp
            args: "([\\d]+)"
      seeders:
        selector: td:nth-of-type(10)
      leechers:
        selector: td:nth-of-type(11)
      downloadvolumefactor:
        case:
          "img[title=\"Free Torrent\"]": "0" # torrent specific free leech (icon)?
          "a.info:contains(\"Free\")": "0" # global freeleech note?
          "*": "1"
      uploadvolumefactor:
        text: "1"
