---
id: bt4g
name: BT4G
description: "BT4G is a Public metadata crawler for magnets"
language: en-US
type: public
encoding: UTF-8
links:
  - https://bt4g.org/

caps:
  categories:
    Application: PC
    Archive file: Other
    Audio: Audio
    Doc: Books
    Other: Other
    Video: Movies
    TV: TV # dummy cat to allow both Movies,TV to be categorised when Video is found.

  modes:
    search: [q]
    tv-search: [q]
    movie-search: [q]
    music-search: [q]
    book-search: [q]

settings: []

search:
  paths:
    # https://bt4g.org/search/2021
    # site does not support cat search
    - path: "search/{{ if .Keywords }}{{ .Keywords }}{{ else }}{{ .Today.Year }}{{ end }}"

  rows:
    selector: div.row > div.col > div:has(h5)

  fields:
    title:
      selector: a
    category:
      selector: span.cpill
    category|append:
      # add tv to video
      optional: true
      selector: span.cpill
      filters:
        - name: replace
          args: ["Video", "TV"]
    details:
      selector: a
      attribute: href
    infohash:
      selector: a
      attribute: href
      filters:
        - name: replace
          args: ["/magnet/", ""]
    date:
      selector: span:nth-last-child(5) b
      filters:
        - name: dateparse
          args: "2006-01-02"
    files:
      selector: span:nth-last-child(4) b
    size:
      selector: span:nth-last-child(3) b
    seeders:
      selector: span:nth-last-child(2) b
    leechers:
      selector: span:nth-last-child(1) b
    downloadvolumefactor:
      text: 0
    uploadvolumefactor:
      text: 1
# engine n/a
