torrent/nushell/examples/schiit.nu

23 lines
446 B
Plaintext
Raw Normal View History

2024-01-13 10:01:54 +00:00
#!/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