mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
commit
f23f784f57
2 changed files with 14 additions and 0 deletions
5
webscraping/README.md
Normal file
5
webscraping/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Web scraping
|
||||
|
||||
### Definition
|
||||
|
||||
This folder includes examples of using nushell to scrape server side rendered websites
|
9
webscraping/scraping.nu
Executable file
9
webscraping/scraping.nu
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env nu
|
||||
let baseurl = 'https://www.schiit.co.uk/'
|
||||
let pages = [headphone-amps dacs schiit-gaming-products power-amplifiers preamps upgrades accessories-cables schiit%20graded%20stock]
|
||||
$pages|each {
|
||||
let product = $it
|
||||
fetch (build-string $baseurl $product)|selector 'div.caption' -a|each {
|
||||
echo [[($it|selector 'h5'|str trim)]; [(echo $it|selector 'p.stock')]]|pivot $product availability
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue