This package helps to measure inflation in Spain, scraping various supermarkets websites, using Puppeteer.
Also useful if you need data of thousands of products to practice or develop a personal project.
Websites scraped:
To use Scraping Inflation in your project, run:
npm i scraping-inflation
Example
const scraping = require("scraping-inflation");
scraping.mercadona(true, true, true, "28001").then((products) => {
// Do something with products
});
(async function getCarrefourProducts() {
let products = await scraping.carrefour(false, false, true);
// Do something with products
})();
let diaProducts = scraping.dia(true, false, false);
diaProducts.then((products) => {
// Do something with products
});
To run Chromium in headless mode, set first argument to true
.
To save products in .json file, set second argument to true
.
To save process log in a .txt file, set third argument to true
, otherwise the progress of the scraping process will be printed in the STDOUT (console).
Result JSONs
The result of the scraping process is an array of JSON of all the products of the website.
The JSONs properties are:
{
description: // { string } Product name and format
source: // { string } "mercadona" || "carrefour" || "dia"
image: // { string } Image URL
url: // { string } Product details URL (if any)
category: // { string } Product category
subcategory: // { string } Product subcategory
class: // { string } Product class or third level category
price: // { string } Price in € (includes € symbol)
pricePerUnit: // { string } Price per kilogram or litre (if any)
}