File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ const selectors = {
2020 title : '.B_NuCI' ,
2121 price1 : '._30jeq3._16Jk6d' ,
2222 image1 : '#container > div > div._2c7YLP.UtUXW0._6t1WkM._3HqJxg > div._1YokD2._2GoDe3 > div._1YokD2._3Mn1Gg.col-5-12._78xt5Y > div:nth-child(1) > div > div._3li7GG > div._1BweB8 > div._3kidJX > div.CXW8mj._3nMexc > img' ,
23+ } ,
24+ snapdeal : {
25+ title : '#productOverview > div.col-xs-14.right-card-zoom.reset-padding > div > div.pdp-fash-topcenter-inner.layout > div.row > div.col-xs-18 > h1' ,
26+ price1 : '#buyPriceBox > div.row.reset-margin > div.col-xs-14.reset-padding.padL8 > div.disp-table > div.pdp-e-i-PAY-r.disp-table-cell.lfloat > span.pdp-final-price > span' ,
27+ image1 : '#bx-slider-left-image-panel > li:nth-child(1) > img'
2328 }
2429}
2530
@@ -36,9 +41,11 @@ const getProductDetails = async(url, merchant) => {
3641 let link = new URL ( url ) ;
3742 if ( merchant == 'amazon' ) link . searchParams . set ( 'tag' , 'asloot-21' ) ;
3843 link = link . toString ( ) ;
39- const price = parseInt ( $ ( selector . price1 ) . text ( ) . trim ( ) . replace ( / ^ \D + | [ ^ 0 - 9 . ] / g, '' ) ) || parseInt ( $ ( selector . price2 ) . text ( ) . trim ( ) . replace ( / ^ \D + | [ ^ 0 - 9 . ] / g, '' ) ) ;
44+ const price = parseInt ( $ ( selector . price1 ) . text ( ) )
45+ // .trim().replace(/^\D+|[^0-9.]/g, '')) || parseInt($(selector.price2).text().trim().replace(/^\D+|[^0-9.]/g, ''));
4046 const title = $ ( selector . title ) . text ( ) . trim ( ) ;
4147 const image = $ ( selector . image1 ) . attr ( 'src' ) ;
48+ console . log ( price , title , image ) ;
4249 if ( ! title || ! price ) {
4350 return { ok : false }
4451 }
You can’t perform that action at this time.
0 commit comments