apify-js-sdk
БесплатноБез исполняемых скриптовНе проверенApify JS SDK Documentation - Web scraping, crawling, and Actor development
Об этом скилле
Apify-Js-Sdk Skill
Comprehensive assistance with Apify JavaScript SDK development for web scraping, crawling, and Actor creation. This skill provides access to official Apify documentation covering the API, SDK, and platform features.
When to Use This Skill
This skill should be triggered when:
- Building web scrapers or crawlers with Apify
- Working with Apify Actors (creation, management, deployment)
- Using the Apify JavaScript Client to interact with the Apify API
- Managing Apify datasets, key-value stores, or request queues
- Implementing data extraction with Cheerio or other parsing libraries
- Setting up crawling workflows with link extraction and filtering
- Debugging Apify code or Actor runs
- Configuring logging and monitoring for Apify Actors
- Learning Apify platform best practices
Key Concepts
Actors
Serverless cloud programs running on the Apify platform. Actors can perform various tasks like web scraping, data processing, or automation.
Datasets
Storage for structured data (results from scraping). Each Actor run can have an associated dataset where scraped data is stored.
Key-Value Stores
Storage for arbitrary data like files, screenshots, or configuration. Each Actor run has a default key-value store.
Request Queue
Queue for managing URLs to be crawled. Handles URL deduplication and retry logic automatically.
Apify Client
JavaScript/Python library for interacting with the Apify API programmatically from your code.
Quick Reference
Basic Link Extraction with Cheerio
Extract all links from a webpage using Cheerio:
import * as cheerio from 'cheerio';
import { gotScraping } from 'got-scraping';
const storeUrl = 'https://warehouse-theme-metal.myshopify.com/collections/sales';
const response = await gotScraping(storeUrl);
const html = response.body;
const $ = cheerio.load(html);
// Select all anchor elements
const links = $('a');
// Extract href attributes
for (const link of links) {
const url = $(link).attr('href');
console.log(url);
}
Running an Actor with Apify Client
Call an Actor and wait for results:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: 'YOUR_API_TOKEN',
});
// Run an Actor and wait for it to finish
const run = await client.actor('some_actor_id').call();
// Get dataset items from the run
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
Creating and Managing Datasets
Store scraped data in a dataset:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: 'YOUR_API_TOKEN',
});
// Create a new dataset
const dataset = await client.datasets().getOrCreate('my-dataset');
// Add items to the dataset
await client.dataset(dataset.id).pushItems([
{ title: 'Product 1', price: 29.99 },
{ title: 'Product 2', price: 39.99 },
]);
// Retrieve items
const { items } = await client.dataset(dataset.id).listItems();
Key-Value Store Operations
Store and retrieve arbitrary data:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: 'YOUR_API_TOKEN',
});
const store = await client.keyValueStores().getOrCreate('my-store');
// Store a value
await client.keyValueStore(store.id).setRecord({
key: 'config',
value: { apiUrl: 'https://api.example.com' },
});
// Retrieve a value
const record = await client.keyValueStore(store.id).getRecord('config');
console.log(record.value);
Logging Configuration
Set up proper logging for Apify Actors:
import logging
from apify.log import ActorLogFormatter
async def main() -> None:
handler = logging.StreamHandler()
handler.setFormatter(ActorLogFormatter())
apify_logger = logging.getLogger('apify')
apify_logger.setLevel(logging.DEBUG)
apify_logger.addHandler(handler)
Using the Actor Context
Access Actor run context and storage:
from apify import Actor
async def main() -> None:
async with Actor:
# Log messages
Actor.log.info('Starting Actor run')
# Access input
actor_input = await Actor.get_input()
# Save data to dataset
await Actor.push_data({
'url': 'https://example.com',
'title': 'Example Page'
})
# Save to key-value store
await Actor.set_value('OUTPUT', {'status': 'done'})
Running an Actor Task
Execute a pre-configured Actor task:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: 'YOUR_API_TOKEN',
});
// Run a task with custom input
const run = await client.task('task-id').call({
startUrls: ['https://example.com'],
maxPages: 10,
});
console.log(`Task run: ${run.id}`);
Redirecting Logs from Called Actors
Redirect logs from a called Actor to the parent run:
from apify import Actor
async def main()
Установить apify-js-sdk в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл apify-js-sdk?
Apify JS SDK Documentation - Web scraping, crawling, and Actor development
Как установить скилл apify-js-sdk?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл apify-js-sdk запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic