doc: added extractDescription function
This commit is contained in:
1 parent
e9d49ab8bf
commit
a76e139dd7
1 file changed
+4
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user