
NPM Scraper
- epctex/npm-scraper
- Modified
- Users 3
- Runs 278
- Created by
epctex
One of the most crucial JavaScript communities is at your fingertips. Extract all the package information right away from NPM. Title, maintainers, readme, downloads per version, dependent libraries, and many other information can be retrieved directly! No limits! Get JSON, Excel, XML, and more!
To run the code examples, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token. For a more detailed explanation, please read about running Actors via the API in Apify Docs.
import { ApifyClient } from 'apify-client';
// Initialize the ApifyClient with API token
const client = new ApifyClient({
token: '<YOUR_API_TOKEN>',
});
// Prepare Actor input
const input = {
"startUrls": [
"https://www.npmjs.com/package/lodash",
"https://www.npmjs.com/~ljharb",
"https://www.npmjs.com/search?q=keywords:front-end&page=0&ranking=optimal",
"https://www.npmjs.com/search?q=keywords:modules",
"https://www.npmjs.com/search?q=axios"
],
"maxItems": 20,
"endPage": 1,
"customMapFunction": (object) => { return {...object} },
"proxy": {
"useApifyProxy": true
}
};
(async () => {
// Run the Actor and wait for it to finish
const run = await client.actor("epctex/npm-scraper").call(input);
// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
console.dir(item);
});
})();