From a76e139dd7e47e86d408a550106ec96aaf164935 Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Sat, 30 Dec 2023 13:19:52 -0800 Subject: [PATCH] doc: added extractDescription function --- lib/scraper/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/scraper/index.ts b/lib/scraper/index.ts index 36305e3..65803ef 100644 --- a/lib/scraper/index.ts +++ b/lib/scraper/index.ts @@ -1,6 +1,6 @@ import axios from 'axios'; import * as cheerio from 'cheerio'; -import { extractPrice, extractCurrency } from '../utils'; +import { extractPrice, extractCurrency, extractDescription } from '../utils'; export async function scrapeAmazonProduct(url: string) { if (!url) return; @@ -55,6 +55,9 @@ export async function scrapeAmazonProduct(url: string) { const discountRate = $('.savingsPercentage').text().replace(/[-%]/g, ""); + // Add the description for the items + const description = extractDescription($) + // Construct data object with scraped information const data = { url,