---
id: baibako
name: BaibaKo
description: "BaibaKo is a RUSSIAN Semi-Private Torrent Tracker for TV"
language: ru-ru
type: semi-private
encoding: windows-1251
links:
  - http://bko.baibako.tv/ # https is unsupported ERR_CONNECTION_REFUSED
legacylinks:
  - http://baibako.tv/
  - https://baibako.tv/

caps:
  categorymappings:
    - {id: 1, cat: TV, desc: "TV"}

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

settings:
  - name: username
    type: text
    label: Username
  - name: password
    type: password
    label: Password
  - name: striprussian
    type: checkbox
    label: Strip Russian Letters
    default: false
  - name: freeleech
    type: checkbox
    label: Search freeleech only
    default: false
  - name: sort
    type: select
    label: Sort requested from site
    default: 4
    options:
      4: created
      7: seeders
      5: size
      1: 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 }}"
  error:
    - selector: div.login2
  test:
    path: /
    selector: a[href="logout.php"]

search:
  paths:
    - path: browse.php
  inputs:
    search: "{{.Keywords }}"
    # 0 active, 1 incldead, 2 onlydead, 3 gold, 4 seedfree
    incldead: "{{ if .Config.freeleech }}3{{ else }}1{{ end }}"
    sort: "{{ .Config.sort }}"
    type: "{{ .Config.type }}"
  keywordsfilters:
    - name: re_replace
      args: ["[s|S](\\d+)[e|E][\\d]+", "/s$1"]

  rows:
    selector: table > tbody > tr:has(a[href^="details.php?id="])

  fields:
    category:
      text: 1
    title:
      selector: a[href^="details.php?id="]
      filters:
        - name: re_replace
          args: ["[\\/]+", ""]
        - name: replace
          args: [" (Золото)", ""]
        - name: replace
          args: ["-Rip", "Rip"]
        - name: replace
          args: ["WEB-DL", "WEBDL"]
        - name: replace
          args: ["WEBRip", "WEBDL"]
        - name: re_replace
          args: ["WEBDLRip", "WEBDL"]
        - name: replace
          args: ["HD720p", "HD 720p"]
        - name: replace
          args: ["HDR720p", "HD 720p"]
        - name: replace
          args: ["HD1080p", "HD 1080p"]
        - name: replace
          args: ["HDR1080p", "HD 1080p"]
        - name: re_replace
          args: ["(\\([А-Яа-яЁё\\W]+\\))|(^[А-Яа-яЁё\\W\\d]+\\/ )|([а-яА-ЯЁё \\-]+,+)|([а-яА-ЯЁё]+)", "{{ if .Config.striprussian }}{{ else }}$1$2$3$4{{ end }}"]
        - name: append
          args: " - rus"
    details:
      selector: a[href^="details.php?id="]
      attribute: href
    poster:
      selector: img[src^="/posters/"]
      attribute: src
    download:
      selector: a[href^="download.php?id="]
      attribute: href
    date:
      selector: small
      filters:
        - name: replace
          args: ["Загружена: ", ""]
        - name: replace
          args: [" в ", " "]
        - name: replace
          args: ["января", "January"]
        - name: replace
          args: ["февраля", "February"]
        - name: replace
          args: ["марта ", "March"]
        - name: replace
          args: ["апреля", "April"]
        - name: replace
          args: ["мая", "May"]
        - name: replace
          args: ["июня", "June"]
        - name: replace
          args: ["июля", "July"]
        - name: replace
          args: ["августа", "August"]
        - name: replace
          args: ["сентября", "September"]
        - name: replace
          args: ["октября", "October"]
        - name: replace
          args: ["ноября", "November"]
        - name: replace
          args: ["декабря", "December"]
        - name: append
          args: " +03:00" # MSK
        - name: dateparse
          args: "2 January 2006 15:04:05 -07:00"
    files:
      selector: td:nth-last-child(5)
    size:
      selector: td:nth-last-child(3)
    seeders:
      selector: td:nth-last-child(2)
      filters:
        - name: split
          args: ["|", 0]
    leechers:
      selector: td:nth-last-child(2)
      filters:
        - name: split
          args: ["|", 1]
    grabs:
      selector: td:nth-last-child(1)
    downloadvolumefactor:
      case:
        "a[href^=\"details.php?id=\"]:contains(\"(Золото)\")": 0
        "*": 1
    uploadvolumefactor:
      text: 1
    minimumratio:
      text: 0.3
# engine n/a
