Skip to content

Instantly share code, notes, and snippets.

@Reino17
Created June 18, 2020 22:31
Show Gist options
  • Select an option

  • Save Reino17/2f166849a0ebe8c64a36613723ebac64 to your computer and use it in GitHub Desktop.

Select an option

Save Reino17/2f166849a0ebe8c64a36613723ebac64 to your computer and use it in GitHub Desktop.
$ xidel -s https://www.anekalogam.co.id/id -e '$raw' > anekalogam.htm
$ xidel -s anekalogam.htm -e '//div[@class="product-box"]//span[@class="n-heading"]'
Rp 905.000
Rp 830.000
Rp 1.750.000
Rp 1.660.000
Rp 2.595.000
Rp 2.490.000
Rp 4.295.000
Rp 4.150.000
Rp 8.530.000
Rp 8.300.000
Rp 21.225.000
Rp 20.750.000
Rp 42.350.000
Rp 41.500.000
Rp 84.300.000
Rp 83.300.000
$ xidel -s anekalogam.htm -e '//div[@class="product-box"]//span[@class="n-heading"] ! replace(substring-after(.,"Rp "),"\.","")'
#or
$ xidel -s anekalogam.htm -e '//div[@class="product-box"]//span[@class="n-heading"] ! string-join(extract(.,"\d+",0,"*"))'
905000
830000
1750000
1660000
2595000
2490000
4295000
4150000
8530000
8300000
21225000
20750000
42350000
41500000
84300000
83300000
$ xidel -s anekalogam.htm -e '//div[@class="product-box"]//h3'
Emas LM 1 gram
Emas LM 2 gram
Emas LM 3 gram
Emas LM 5 gram
Emas LM 10 gram
Emas LM 25 gram
Emas LM 50 gram
Emas LM 100 gram
$ xidel -s anekalogam.htm -e '//div[@class="product-box"]/extract(.//h3,"\d+")'
1
2
3
5
10
25
50
100
$ xidel -s anekalogam.htm -e '
//div[@class="product-box"]/(
for $x in .//span[@class="n-heading"] ! string-join(extract(.,"(\d+)",0,"*")) return
$x div extract(.//h3,"\d+")
)
'
905000
830000
875000
830000
865000
830000
859000
830000
853000
830000
849000
830000
847000
830000
843000
833000
$ xidel -s anekalogam.htm -e '
//div[@class="product-box"]/join(
for $x in .//span[@class="n-heading"] ! string-join(extract(.,"(\d+)",0,"*")) return
$x div extract(.//h3,"\d+"),
" - "
)
'
905000 - 830000
875000 - 830000
865000 - 830000
859000 - 830000
853000 - 830000
849000 - 830000
847000 - 830000
843000 - 833000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment