1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 15:17:47 +00:00

Update nuschiit.nu (used deprecated fetch) (#453)

updated the script to no longer use fetch and properly trim strings
This commit is contained in:
D3V1LC0D3R 2023-04-19 18:38:41 +02:00 committed by GitHub
parent a49b6c5f0e
commit 4157914f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,17 +4,18 @@ let pages = ['headphone-amps' 'dacs' 'schiit-gaming-products' 'power-amplifiers'
# Simple script to check stock of https://schiit.co.uk store # Simple script to check stock of https://schiit.co.uk store
def main [] { def main [] {
$pages|par-each {|page| $pages | par-each { |page|
fetch $"($baseurl)($page)" http get ($baseurl + $page)
|query web -q '.price, .stock, .product-item h5' |query web -q '.price, .stock, .product-item h5'
|str trim
|group 3 |group 3
|each { |each {
str trim |x| {
|rotate --ccw name availability price name: $x.0,
avail: $x.1,
price: $x.2
} }
|flatten
} }
|flatten }
|uniq |sort-by avail
|sort-by availability
} }