Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
flipkart-scraper
Advanced tools
[![NPM](https://nodei.co/npm/flipkart-scraper.png)](https://nodei.co/npm/flipkart-scraper/)
This package will help us to scrape all Flipkart products through Flipkart affiliate API.
Please refer API Documentation here.
See the Examples here
Install using 'npm'
npm i flipkart-scraper
Install using 'yarn'
yarn add flipkart-scraper
import { FlipkartScraper } from "flipkart-scraper";
const scraper = new FlipkartScraper(
"<Affiliate-Id-Here>",
"<Affiliate-Token-Here>"
);
// 'data' event handler
scraper.on("data", (data) => {
console.log(data.products.length);
});
// Start the scraper
scraper.start();
This module will help us to scrape all the Flipkart products.
This will create instance of the FlipkartScraper
class with required authentication params.
concurrency?
{number} Number for parallel processing in the queue, Default set to 2
maxRequest?
{number} Maximum request to Flipkart affliate server, Default set to 0
- means unlimitedmaxPage?
{number} Maximum number of pages to scrape per category, Default set to 0
- means unlimitedExample
const scraper = new FlipkartScraper(
"<Affiliate-Id-Here>",
"<Affiliate-Token-Here>",
{
/**
* It will make 5 parallel request to Flipkart.
* This is optional param, default is set to 2
**/
concurrency: 5,
/**
* It will make only 500 request to Flipkart. After that program ends.
* This is optional param, default is set to 0 means unlimited
**/
maxRequest: 500,
/**
* Maximum 3 request per category
**/
maxPage: 3,
}
);
This method will start scraping through Flipkart affiliate API.
categoriesToScrape?
{string[]} Pass the list of categories that you want to scrape. Default set to []
which means all categories.Example
scraper.start(["telivision", "mobiles"]); // It will scrape only specified categories
This method will show the stats of scraper. By default stats will come as numerals like (3.1k, 1.45GB)
showAsNumbers?
{boolean} Stats will return as number instead of numerals.Sample Stats
/*
{
"startTime": "2021-02-21T08:14:29.445Z",
"endTime": undefined, // endTime will be available once scraping finished
"status": "inprogress",
"concurrency": 30,
"waitingRequests": 0,
"productsCount": "19.54k",
"elapsed": "0:00:06 10ms",
"durationPerMillionProducts": "0:05:08 558ms",
"productsPerSec": "3.25k products/sec",
"avgResponseTime": "147ms",
"requestPerSec": "7/sec",
"requestedCount": "43.00",
"processedCount": "41.00",
"errorCount": "0.0",
"retryCount": "0.0",
"retryHaltCount": "0.0",
"pendingCategory": 2,
"completedCategory": 1,
"downloadSize": "84.78MB",
"downloadedSpeed": "14.11MB/sec",
"info": {
"pendingCategories": [
{
"category": "mens_clothing",
"startTime": "2021-02-21T08:14:29.602Z",
"noOfPages": 18,
"elapsed": 5668,
"totalProducts": 9000
},
{
"category": "mobiles",
"startTime": "2021-02-21T08:14:29.603Z",
"noOfPages": 13,
"elapsed": 5771,
"totalProducts": 6500
}
],
"completedCategories": [
{
"category": "laptops",
"noOfPages": 10,
"totalProducts": 4500,
"elapsed": 3878
}
]
}
}
*/
Emitted when successful HTTP response from the Flipkart Affiliate server.
Example
// 'response' event handler
scraper.on("response", (response) => {
console.log(response);
});
Emitted when products returned from Flipkart affiliate API.
Example
// 'data' event handler
scraper.on("data", (data) => {
console.log(data.apiData.products);
});
Emitted when all products scraped for the category.
Example
// 'categoryCompleted' event handler
scraper.on("categoryCompleted", (completedCategoryInfo) => {
console.log(completedCategoryInfo);
});
Emitted when scraper finished.
Example
// 'finished' event handler
scraper.on("finished", (info) => {
console.log(info);
});
Emitted if any errors occured.
Example
// Triggered if any error occured
scraper.on("error", (error) => {
console.error(error);
});
Emitted if any retry occured.
Example
// Triggered if any retry occured
scraper.on("retry", (retryInfo) => {
console.log(retryInfo);
});
Emitted if any retries failed for 10 times.
Example
// Triggerd when retry failed 10 times
scraper.on("retryHalted", (retryHaltInfo) => {
console.error(retryHaltInfo);
});
FAQs
[![NPM](https://nodei.co/npm/flipkart-scraper.png)](https://nodei.co/npm/flipkart-scraper/)
We found that flipkart-scraper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.