assorted yml: use default: statement for optional fields

Size, Seeders, Leechers. Grabs
This commit is contained in:
Garfield69 2023-03-21 10:18:07 +13:00
parent 0f9f173cc5
commit 76e5157393
21 changed files with 118 additions and 168 deletions

View File

@ -156,43 +156,39 @@ search:
selector: table.tableinborder > tbody > tr:has(a[href^="/download.php"])
fields:
title:
selector: a[href^="details.php"]
attribute: title
category:
selector: a[href^="/browse.php?cat="]
attribute: href
filters:
- name: querystring
args: cat
title:
selector: a[href^="details.php"]
attribute: title
details:
selector: a[href^="details.php"]
attribute: href
download:
selector: a[href^="/download.php"]
attribute: href
grabs_optional:
grabs:
selector: a[title="Snatcher"]
optional: true
grabs:
text: "{{ if .Result.grabs_optional }}{{ .Result.grabs_optional }}{{ else }}0{{ end }}"
files_optional:
default: 0
files:
selector: a[title="Files"]
optional: true
files:
text: "{{ if .Result.files_optional }}{{ .Result.files_optional }}{{ else }}0{{ end }}"
default: 0
size:
selector: td:nth-child(6)
seeders_optional:
seeders:
selector: a[title="Seeder"]
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: a[title="Leecher"]
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
# 2 flavours of dates
date_day:
# Heute 13:30:04

View File

@ -300,26 +300,22 @@ search:
filters:
- name: querystring
args: f
size_optional:
optional: true
selector: td:contains(\00a0GB), td:contains(\00a0MB), td:contains(\00a0kB), td:contains(\00a0B)
size:
text: "{{ if .Result.size_optional }}{{ .Result.size_optional }}{{ else }}0 B{{ end }}"
seeders_optional:
selector: td:contains(\00a0GB), td:contains(\00a0MB), td:contains(\00a0kB), td:contains(\00a0B)
optional: true
selector: td[title="Seeders"]
default: 0
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: td[title="Seeders"]
optional: true
selector: td[title="Leechers"]
default: 0
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
grabs_optional:
selector: td[title="Leechers"]
optional: true
selector: td[title^="Replies:"]
default: 0
grabs:
text: "{{ if .Result.grabs_optional }}{{ .Result.grabs_optional }}{{ else }}0{{ end }}"
selector: td[title^="Replies:"]
optional: true
default: 0
downloadvolumefactor:
text: 1
uploadvolumefactor:

View File

@ -108,9 +108,10 @@ search:
selector: .title a
attribute: href
date:
optional: true
selector: .t_files_size_added time
attribute: datetime
optional: true
default: now
download:
selector: a[title="Download"]
attribute: href
@ -122,21 +123,18 @@ search:
size:
selector: .t_files_size_added span
attribute: data-bytecount
seeders_optional:
optional: true
selector: .seeders
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: .seeders
optional: true
selector: .leechers
default: 0
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
grabs_optional:
selector: .leechers
optional: true
selector: .snatches
default: 0
grabs:
text: "{{ if .Result.grabs_optional }}{{ .Result.grabs_optional }}{{ else }}0{{ end }}"
selector: .snatches
optional: true
default: 0
downloadvolumefactor:
text: 1
uploadvolumefactor:

View File

@ -139,16 +139,14 @@ search:
selector: div.poid
date:
text: now
seeders_optional:
seeders:
selector: div.up
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: div.down
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -139,16 +139,14 @@ search:
args: ["(\\d+)\\.\\d", "$1 MB"]
date:
text: now
seeders_optional:
seeders:
selector: div.up
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: div.down
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -86,16 +86,14 @@ search:
selector: div.poid
date:
text: now
seeders_optional:
seeders:
selector: div.up
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: div.down
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -132,16 +132,14 @@ search:
- name: timeago
size:
selector: td:nth-last-of-type(4)
seeders_optional:
optional: true
selector: td.sy, td.sn
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: td.sy, td.sn
optional: true
selector: td.ly, td.ln
default: 0
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
selector: td.ly, td.ln
optional: true
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -177,16 +177,14 @@ search:
args: " +01:00" # CET
- name: dateparse
args: "d MMMM yyyy HH:mm:ss zzz"
seeders_optional:
optional: true
selector: table tr:nth-child(3) td:nth-child(5) font b
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: table tr:nth-child(3) td:nth-child(5) font b
optional: true
selector: table tr:nth-child(3) td:nth-child(5) font b:nth-child(2)
default: 0
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
selector: table tr:nth-child(3) td:nth-child(5) font b:nth-child(2)
optional: true
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -119,30 +119,27 @@ search:
size:
selector: div.trbo div:nth-last-child(8)
remove: i
seeders_optional:
seeders:
selector: div.trbo div:nth-last-child(7)
optional: true
filters:
- name: re_replace
args: ["\\s", "0"]
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: div.trbo div:nth-last-child(6)
optional: true
default: 0
filters:
- name: re_replace
args: ["\\s", "0"]
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
grabs_optional:
selector: div.trbo div:nth-last-child(5)
selector: div.trbo div:nth-last-child(6)
optional: true
default: 0
filters:
- name: re_replace
args: ["\\s", "0"]
grabs:
text: "{{ if .Result.grabs_optional }}{{ .Result.grabs_optional }}{{ else }}0{{ end }}"
selector: div.trbo div:nth-last-child(5)
optional: true
default: 0
filters:
- name: re_replace
args: ["\\s", "0"]
date:
remove: a, span
selector: div[style="float:right;"]

View File

@ -125,22 +125,20 @@ search:
attribute: href
size:
selector: td:nth-child(3)
seeders_optional:
seeders:
selector: td:nth-child(4)
optional: true
default: 1
filters:
- name: re_replace
args: ["(\\d*) \\(\\+\\d*\\)\n? \\| (\\d*) \\(\\+\\d*\\)", "$1"]
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}1{{ end }}"
leechers_optional:
leechers:
selector: td:nth-child(4)
optional: true
default: 1
filters:
- name: re_replace
args: ["(\\d*) \\(\\+\\d*\\)\n? \\| (\\d*) \\(\\+\\d*\\)", "$2"]
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}1{{ end }}"
date:
selector: td:nth-child(2) i
filters:

View File

@ -155,16 +155,14 @@ search:
- name: append
args: " hours ago"
- name: timeago
seeders_optional:
optional: true
selector: table tr:nth-child(3) td:nth-child(5) font b
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: table tr:nth-child(3) td:nth-child(5) font b
optional: true
selector: table tr:nth-child(3) td:nth-child(5) font b:nth-child(2)
default: 0
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
selector: table tr:nth-child(3) td:nth-child(5) font b:nth-child(2)
optional: true
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -146,16 +146,14 @@ search:
args: " +01:00" # CET
- name: dateparse
args: "d MMMM yyyy HH:mm:ss zzz"
seeders_optional:
optional: true
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font b
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font b
optional: true
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font font b
default: 0
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font font b
optional: true
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -177,21 +177,18 @@ search:
args: " -00:00" # GMT
- name: dateparse
args: "yyyy-MM-dd HH:mm zzz"
seeders_optional:
seeders:
selector: td:nth-child(6):not(:empty)
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: td:nth-child(7):not(:empty)
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
grabs_optional:
default: 0
grabs:
selector: td:nth-child(8):not(:empty)
optional: true
grabs:
text: "{{ if .Result.grabs_optional }}{{ .Result.grabs_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -172,21 +172,18 @@ search:
optional: true
size:
text: "{{ if .Result.size_optional }}{{ .Result.size_optional }}{{ else }}1 GB{{ end }}"
seeders_optional:
seeders:
selector: dd.posts span.my_tt.seed
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: dd.posts span.my_tt.leech
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
grabs_optional:
default: 0
grabs:
selector: dd.views span.my_tt.complet
optional: true
grabs:
text: "{{ if .Result.grabs_optional }}{{ .Result.grabs_optional }}{{ else }}0{{ end }}"
default: 0
date:
selector: div.left-box time
downloadvolumefactor:

View File

@ -144,16 +144,14 @@ search:
args: " +01:00" # CET
- name: dateparse
args: "d MMMM yyyy HH:mm:ss zzz"
seeders_optional:
optional: true
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font b
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
optional: true
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font font b
default: 0
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font b
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
optional: true
default: 0
selector: td:nth-child(4) table tr:nth-child(3) td:nth-child(5) font font b
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -370,9 +370,10 @@ search:
download:
selector: a.topictitle
attribute: href
size_optional:
size:
selector: td:nth-of-type(5) p:not(:empty)
optional: true
default: 0 B
filters:
- name: replace
args: ["ТБ", "TB"]
@ -382,18 +383,14 @@ search:
args: ["МБ", "MB"]
- name: replace
args: ["КБ", "KB"]
size:
text: "{{ if .Result.size_optional }}{{ .Result.size_optional }}{{ else }}0 B{{ end }}"
seeders_optional:
seeders:
selector: span.seed
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: span.leech
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
date_minutes:
# 55 минут назад
selector: td:nth-of-type(6) p:nth-of-type(1):contains("минут")

View File

@ -189,16 +189,14 @@ search:
args: ["Go", "GB"]
- name: replace
args: ["To", "TB"]
seeders_optional:
seeders:
selector: "{{ if .Keywords }}td:nth-child(4){{ else }}td:nth-child(3){{ end }}"
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: "{{ if .Keywords }}td:nth-child(5){{ else }}td:nth-child(4){{ end }}"
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -137,16 +137,14 @@ search:
text: now
size:
selector: td:nth-child(2)
seeders_optional:
seeders:
selector: td:nth-child(3)
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: td:nth-child(4)
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 0
uploadvolumefactor:

View File

@ -169,16 +169,14 @@ search:
poster:
selector: div[class^="torrent-name"] a
attribute: data-poster-preview
seeders_optional:
seeders:
selector: td.seeders_cell:not(:has(i))
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: td.leechers_cell:not(:has(i))
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
size:
selector: td.size_cell
downloadvolumefactor:

View File

@ -345,16 +345,14 @@ search:
args: ["o", "B"]
grabs:
selector: td:nth-child(7)
seeders_optional:
seeders:
selector: td:nth-child(8)
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: td:nth-child(9)
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 1
uploadvolumefactor:

View File

@ -352,16 +352,14 @@ search:
args: ["o", "B"]
grabs:
selector: td:nth-child(7)
seeders_optional:
seeders:
selector: td:nth-child(8)
optional: true
seeders:
text: "{{ if .Result.seeders_optional }}{{ .Result.seeders_optional }}{{ else }}0{{ end }}"
leechers_optional:
default: 0
leechers:
selector: td:nth-child(9)
optional: true
leechers:
text: "{{ if .Result.leechers_optional }}{{ .Result.leechers_optional }}{{ else }}0{{ end }}"
default: 0
downloadvolumefactor:
text: 1
uploadvolumefactor: