torrent/nushell/examples/schiit.nu
2024-01-13 13:01:54 +03:00

23 lines
446 B
Plaintext

#!/usr/bin/env nu
let baseurl = 'https://www.schiit.co.uk/'
let pages = ['headphone-amps' 'dacs']
# Simple script to check stock of https://schiit.co.uk store
def schiit [] {
$pages | par-each { |page|
http get ($baseurl + $page)
|query web -q '.price, .stock, .product-item h5'
|str trim
|group 3
|each {
|x| {
name: $x.0,
avail: $x.1,
price: $x.2
}
}
}
|sort-by avail
}
schiit