mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +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:
parent
a49b6c5f0e
commit
4157914f71
1 changed files with 9 additions and 8 deletions
|
@ -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
|
|sort-by avail
|
||||||
|uniq
|
|
||||||
|sort-by availability
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue