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.
The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.
Apify SDK provides the tools required to run your own Apify Actors. The crawlers and scraping related tools, previously included in Apify SDK (v2), have been split into a brand-new module - crawlee
, while keeping the Apify specific parts in this module.
Would you like to work with us on Crawlee, Apify SDK or similar projects? We are hiring Node.js engineers.
A lot of things have changed since version 2 of the Apify SDK, including the split of the crawlers to the new crawlee
module. We've written a guide to help you easily migrate from v2 to v3. Visit the Upgrading Guide to find out what changes you need to make (especially the section related to this very Apify SDK), and, if you encounter any issues, join our Discord server for help!
This short tutorial will set you up to start using Apify SDK in a minute or two. If you want to learn more, proceed to the Apify Platform guide that will take you step by step through running your Actor on Apify's platform.
Apify SDK requires Node.js 16 or later. Add Apify SDK to any Node.js project by running:
npm install apify crawlee playwright
For this example, we'll also install the
crawlee
module, as it now provides the crawlers that were previously exported by Apify SDK. If you don't plan to use crawlers in your Actors, then you don't need to install it. Keep in mind that neitherplaywright
norpuppeteer
are bundled withcrawlee
in order to reduce install size and allow greater flexibility. That's why we manually install it with NPM. You can choose one, both, or neither.
There are two ways to initialize your Actor: by using the Actor.main()
function you're probably used to, or by calling Actor.init()
and Actor.exit()
manually. We prefer explicitly calling init
and exit
.
Actor.init()
and Actor.exit()
import { Actor } from 'apify';
import { PlaywrightCrawler } from 'crawlee';
await Actor.init()
const crawler = new PlaywrightCrawler({
async requestHandler({ request, page, enqueueLinks }) {
// Extract HTML title of the page.
const title = await page.title();
console.log(`Title of ${request.url}: ${title}`);
// Add URLs that point to the same hostname.
await enqueueLinks();
},
});
await crawler.run(['https://crawlee.dev/']);
await Actor.exit();
Actor.main()
import { Actor } from 'apify';
import { PlaywrightCrawler } from 'crawlee';
await Actor.main(async () => {
const crawler = new PlaywrightCrawler({
async requestHandler({ request, page, enqueueLinks }) {
// Extract HTML title of the page.
const title = await page.title();
console.log(`Title of ${request.url}: ${title}`);
// Add URLs that point to the same hostname.
await enqueueLinks();
},
});
await crawler.run(['https://crawlee.dev/']);
});
If you find any bug or issue with the Apify SDK, please submit an issue on GitHub. For questions, you can ask on Stack Overflow or contact support@apify.com
Your code contributions are welcome, and you'll be praised to eternity! If you have any ideas for improvements, either submit an issue or create a pull request. For contribution guidelines and the code of conduct, see CONTRIBUTING.md.
This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.
Many thanks to Chema Balsas for giving up the apify
package name
on NPM and renaming his project to jsdocify.
FAQs
The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.
The npm package apify receives a total of 7,288 weekly downloads. As such, apify popularity was classified as popular.
We found that apify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.