---
id: magicheaven
name: magic-heaven
description: "magic-heaven is a Private Torrent Tracker for MOVIES / TV / GENERAL"
language: en-US
type: private
encoding: UTF-8
testlinktorrent: false
links:
  - https://magic-heaven.info/

caps:
  categorymappings:
    - {id: 6, cat: PC, desc: "APPS"}
    - {id: 108, cat: Other, desc: "APPS Wallpapers"}
    - {id: 8, cat: Movies/BluRay, desc: "BLU-RAY"}
    - {id: 172, cat: Movies/BluRay, desc: "BLU-RAY 1080p"}
    - {id: 179, cat: Movies/BluRay, desc: "BLU-RAY 4K"}
    - {id: 176, cat: Movies/BluRay, desc: "BLU-RAY 720p"}
    - {id: 156, cat: Movies/BluRay, desc: "BLU-RAY H264"}
    - {id: 153, cat: Movies/BluRay, desc: "BLU-RAY X264"}
    - {id: 36, cat: Movies/SD, desc: "Cams"}
    - {id: 180, cat: Movies/Other, desc: "Christmas"}
    - {id: 181, cat: Movies/Other, desc: "Christmas Movies"}
    - {id: 182, cat: Audio/Other, desc: "Christmas Music"}
    - {id: 82, cat: Audio/Other, desc: "DJ Music"}
    - {id: 84, cat: Audio/Other, desc: "DJ Music DMC"}
    - {id: 92, cat: Audio/Other, desc: "DJ Music Funkymix"}
    - {id: 83, cat: Audio/Other, desc: "DJ Music MASTERMIX"}
    - {id: 93, cat: Audio/Other, desc: "DJ Music Ultimix"}
    - {id: 3, cat: Movies/DVD, desc: "DVD-R"}
    - {id: 11, cat: Books/EBook, desc: "E BOOKS"}
    - {id: 114, cat: Audio/Audiobook, desc: "E BOOKS Audio Books"}
    - {id: 86, cat: Books/Mags, desc: "E BOOKS Magazines"}
    - {id: 169, cat: Console, desc: "Games"}
    - {id: 178, cat: PC/Games, desc: "Games PC GAMES"}
    - {id: 175, cat: Console/XBox, desc: "Games XBOX"}
    - {id: 167, cat: Audio/Other, desc: "KARAOKE"}
    - {id: 14, cat: Movies/Other, desc: "MKV's"}
    - {id: 13, cat: Audio/MP3, desc: "MP3 RELEASES"}
    - {id: 18, cat: Movies/Other, desc: "MULTI'S"}
    - {id: 98, cat: Movies/Other, desc: "MULTI'S Movie Box Sets"}
    - {id: 183, cat: Audio/Lossless, desc: "MUSIC FLAC"}
    - {id: 20, cat: Audio/MP3, desc: "MUSIC MP3"}
    - {id: 150, cat: Audio, desc: "MUSIC Collections"}
    - {id: 96, cat: Audio, desc: "MUSIC Discographys"}
    - {id: 177, cat: Audio, desc: "MUSIC Rock / Metal"}
    - {id: 171, cat: Audio/Video, desc: "Music-Videos"}
    - {id: 81, cat: Movies, desc: "RatioBoosters"}
    - {id: 26, cat: TV/Sport, desc: "Sport"}
    - {id: 7, cat: Audio, desc: "Top 40 Albums/Singles"}
    - {id: 9, cat: TV, desc: "TV Episodes"}
    - {id: 38, cat: TV, desc: "TV Series"}
    - {id: 30, cat: Other, desc: "VIP"}
    - {id: 158, cat: Other, desc: "VIP GOLD"}
    - {id: 173, cat: Movies/WEB-DL, desc: "Web-dl"}
    - {id: 34, cat: Movies/SD, desc: "Xvid / HDrip"}

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

settings:
  - name: username
    type: text
    label: Username
  - name: password
    type: password
    label: Password
  - name: freeleech
    type: checkbox
    label: Filter freeleech only
    default: false
  - name: sort
    type: select
    label: Sort requested from site
    default: added
    options:
      added: created
      seeders: seeders
      size: size
      name: title
  - name: type
    type: select
    label: Order requested from site
    default: desc
    options:
      desc: desc
      asc: asc

login:
  path: takelogin.php
  method: post
  inputs:
    username: "{{ .Config.username }}"
    password: "{{ .Config.password }}"
    logout: ""
  error:
    - selector: table:has(a[href*="login.php?error=1"])
      message:
        text: "ERROR: Incorrect username!"
    - selector: table:has(a[href*="login.php?error=4"])
      message:
        text: "ERROR: Incorrect password!"
    - selector: table:has(a[href*="login.php?error="])
      message:
        text: "ERROR: Something went wrong during login!"
  test:
    path: index.php
    selector: a[href*="/logout.php?logouthash="]

download:
  before:
    path: takethanks.php
    method: post
    inputs:
      torrentid: "{{ re_replace  .DownloadUri.PathAndQuery \".*torrent-details-(\\d+).*\" \"$1\"}}"
  selectors:
    - selector: a[href*="download-torrent-"]
      attribute: href

search:
  paths:
    - path: browse.php
  inputs:
    do: search
    # does not support multi categories so defaulting to ALL
    category: 0
    # yes incldead, no activeonly
    include_dead_torrents: yes
    keywords: "{{ if .Query.IMDBID }}{{ .Query.IMDBID }}{{ else }}{{ .Keywords }}{{ end }}"
    # t_name, t_description, t_both, t_uploader, t_genre
    search_type: "{{ if .Query.IMDBID }}t_genre{{ else }}t_name{{ end }}"
    sort: "{{ .Config.sort }}"
    order: "{{ .Config.type }}"
    # does not return imdb link in results
  keywordsfilters:
    - name: re_replace # replace special characters with "%" (wildcard)
      args: ["[^a-zA-Z0-9]+", "%"]

  rows:
    selector: "table#sortabletable tbody tr:has(a[href*=\"download-torrent-\"]){{ if .Config.freeleech }}:has(img[src$=\"/freedownload.gif\"]){{ else }}{{ end }}"

  fields:
    category:
      selector: a[href*="torrent-category-"]
      attribute: href
      filters:
        - name: regexp
          args: (\d+)
    title_default:
      # is often abbreviated
      selector: a[href*="torrent-details-"]
    title:
      # usually longer than details title
      selector: div[id^="port-content-"] div
      optional: true
      default: "{{ .Result.title_default }}"
    details:
      selector: a[href*="torrent-details-"]
      attribute: href
    download:
      selector: a[href*="torrent-details-"]
      attribute: href
    poster:
      selector: div[id^="port-content-"] img
      attribute: src
    date:
      selector: td:nth-child(2) > div:last-child
      # auto adjusted by site account profile
      filters:
        - name: regexp
          args: (\d{2}-\d{2}-\d{4} \d{2}:\d{2})
        - name: dateparse
          args: "dd-MM-yyyy HH:mm"
    size:
      selector: td:nth-child(5)
    grabs:
      selector: td:nth-child(6)
    seeders:
      selector: td:nth-child(7)
    leechers:
      selector: td:nth-child(8)
    downloadvolumefactor:
      case:
        img[src$="/freedownload.gif"]: 0
        img[src$="/silverdownload.gif"]: 0.5
        "*": 1
    uploadvolumefactor:
      case:
        img[src$="/x2.gif"]: 2
        "*": 1
    minimumseedtime:
      # 1 day (as seconds = 24 x 60 x 60)
      text: 86400
# TS Special Edition v.8.0
