doc: added extractDescription function

This commit is contained in:
Leon Xu committed 2023-12-30 13:19:52 -08:00
1 parent e9d49ab8bf
commit a76e139dd7
1 file changed
+4 -1
+4 -1
View File
@@ -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,