- Estrazione dei dati da Amazon

- Ciclo di Estrapolazione di tutti i prodotti ed aggiornamento dei campi scraped e scraped_updated
- Creazione file CSV con i campi modificati.
This commit is contained in:
Surya Paolo
2025-05-19 17:33:58 +02:00
parent a374a7d7bc
commit a3c7b92c0c
16 changed files with 5131 additions and 1731 deletions

View File

@@ -139,7 +139,7 @@ function updateProductInfoCatProds(productInfo, reccatprod) {
async function compressPdf(inputFile, outputFile, compressione) {
try {
const tempFolder = path.join(cwd, 'temp');
const hasTempFolder = tools.isFileExists(tempFolder);
const hasTempFolder = await tools.isFileExistsAsync(tempFolder);
if (!hasTempFolder) {
console.log('creo directory', tempFolder);
@@ -176,7 +176,7 @@ async function compressPdf(inputFile, outputFile, compressione) {
async function convertPDF_GS(inputFile, outputFile, width, height) {
// Verifica che il file di input esista
if (!tools.isFileExists(inputFile)) {
if (!await tools.isFileExistsAsync(inputFile)) {
throw new Error(`Il file di input non esiste: ${inputFile}`);
}
@@ -210,7 +210,7 @@ async function convertPDF_GS(inputFile, outputFile, width, height) {
console.log('Conversione completata con successo!');
// Verifica che il file di output sia stato generato
if (tools.isFileExists(outputFile)) {
if (await tools.isFileExistsAsync(outputFile)) {
console.log('File di output generato:', outputFile);
} else {
console.error('Il File di output NON è stato generato! :', outputFile);
@@ -256,7 +256,7 @@ async function extractPdfInfo(inputFile) {
}
async function convertPDF_PdfLib(idapp, inputFile, outputFile, options) {
if (!tools.isFileExists(inputFile)) {
if (!await tools.isFileExistsAsync(inputFile)) {
throw new Error(`Il file di input non esiste: ${inputFile}`);
}

View File

@@ -2425,11 +2425,11 @@ function uploadFile(req, res, version) {
//fit: sharp.fit.cover,
fit: sharp.fit.contain,
// position: sharp.strategy.entropy,
}).withMetadata().toFile(resized_img, function (err) {
}).withMetadata().toFile(resized_img, async function (err) {
// console.log('3) Ridimensionata Immagine ' + newname, 'in', resized_img);
if (tools.isFileExists(resized_img)) {
if (await tools.isFileExistsAsync(resized_img)) {
// console.log('4) Cancella l \'immagine grande originale:', newname);
// DELETE THE ORIGINAL BIG
tools.delete(newname, false, () => { });