Deploy to staging #63
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -20,8 +20,8 @@ export class GraysScrapModel extends ScrapModel {
 | 
			
		|||
 | 
			
		||||
  getPriceByEl = async (elementHandle) => {
 | 
			
		||||
    const selectors = [
 | 
			
		||||
      ".sc-ijDOKB.sc-bStcSt.ikmQUw.eEycyP", // Single product price
 | 
			
		||||
      ".sc-ijDOKB.ikmQUw", // Multiple product price
 | 
			
		||||
      "a > div:nth-child(2) > div:nth-child(2)", // Single product price
 | 
			
		||||
      "a > div:nth-of-type(2) > div:nth-of-type(2) > div > div:nth-of-type(1) > div", // Multiple product price
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    for (const selector of selectors) {
 | 
			
		||||
| 
						 | 
				
			
			@ -43,17 +43,15 @@ export class GraysScrapModel extends ScrapModel {
 | 
			
		|||
 | 
			
		||||
    for (const el of elements) {
 | 
			
		||||
      const url = await el
 | 
			
		||||
        .$eval(".sc-pKqro.sc-gFnajm.gqkMpZ.dzWUkJ", (el) =>
 | 
			
		||||
          el.getAttribute("href")
 | 
			
		||||
        )
 | 
			
		||||
        .$eval("a", (el) => el.getAttribute("href"))
 | 
			
		||||
        .catch(() => null);
 | 
			
		||||
 | 
			
		||||
      const image_url = await el
 | 
			
		||||
        .$eval("img.sc-gtJxfw.jbgdlx", (img) => img.getAttribute("src"))
 | 
			
		||||
        .$eval("img", (img) => img.getAttribute("src"))
 | 
			
		||||
        .catch(() => null);
 | 
			
		||||
 | 
			
		||||
      const name = await el
 | 
			
		||||
        .$eval(".sc-jlGgGc.dJRywx", (el) => el.textContent.trim())
 | 
			
		||||
        .$eval("h2", (el) => el.textContent.trim())
 | 
			
		||||
        .catch(() => null);
 | 
			
		||||
 | 
			
		||||
      const current_price = await this.getPriceByEl(el); // Gọi hàm async được định nghĩa trong class
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue