Last active
April 8, 2019 17:31
-
-
Save peacefulseeker/eb90d398e699830a63b66b935a01a068 to your computer and use it in GitHub Desktop.
Revisions
-
Alexey Vorobyov renamed this gist
Apr 8, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Alexey Vorobyov revised this gist
Apr 8, 2019 . No changes.There are no files selected for viewing
-
Alexey Vorobyov created this gist
Apr 8, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ //https://my.aliexpress.com/wishlist/wish_list_product_list.htm?¤tGroupId=0&page=1 const priceNodes = document.querySelectorAll('.price'); const pricesCollection = Array.from(priceNodes); var prices = pricesCollection.reduce((total, prc) => { const prices = prc.textContent.trim().replace(/[^\d,-]/g, '').replace(/,/g, '.').split('-'); const lowestPrice = Number(prices[0]); const highestPrice = Number(prices[1]) || lowestPrice; return { min: Number((total.min + lowestPrice).toFixed(2)), max: Number((total.max + highestPrice).toFixed(2)), } }, {min: 0, max: 0}); console.log(prices)