Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "apify-js-sdk",
|
||||
"description": "Interacts with the Apify JS SDK. Allows you to work with Actors and other Apify features.",
|
||||
"version": "0.0.0-2025.11.28",
|
||||
"author": {
|
||||
"name": "Tim Green",
|
||||
"email": "rawveg@gmail.com"
|
||||
},
|
||||
"skills": [
|
||||
"./skills/apify-js-sdk"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# apify-js-sdk
|
||||
|
||||
Interacts with the Apify JS SDK. Allows you to work with Actors and other Apify features.
|
||||
64
plugin.lock.json
Normal file
64
plugin.lock.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:rawveg/skillsforge-marketplace:apify-js-sdk",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "cb747056e2f7ce324975aa2914dd61b100ac4378",
|
||||
"treeHash": "a30c63e0b7d2c4f81027ffa80ea7a7aa9131a25af123b05ec2d18ce1bd126050",
|
||||
"generatedAt": "2025-11-28T10:27:49.986090Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "apify-js-sdk",
|
||||
"description": "Interacts with the Apify JS SDK. Allows you to work with Actors and other Apify features."
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "3b6209f07ea1dac0b5bfe71fd7acd77bf05f85ddaa13b78db064b453e52c371e"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "cf7fead44f20aefb8d6fe970e6c99f3b6d0bbdd0bbd31ef50108e10c42e57667"
|
||||
},
|
||||
{
|
||||
"path": "skills/apify-js-sdk/plugin.json",
|
||||
"sha256": "56c78c6019b4a8a4e2328275fe757f9008aa011b85bee330d82b0a6c18ae8007"
|
||||
},
|
||||
{
|
||||
"path": "skills/apify-js-sdk/SKILL.md",
|
||||
"sha256": "a388997ca3ef1064f49aeea83793f1574d5d891d94291249a20851dd3a7fa9d5"
|
||||
},
|
||||
{
|
||||
"path": "skills/apify-js-sdk/references/llms.md",
|
||||
"sha256": "65cf566018e6a70913b2d58981b4a0bc3bd8e42acf6822652efcd6cc94b5433c"
|
||||
},
|
||||
{
|
||||
"path": "skills/apify-js-sdk/references/llms-txt.md",
|
||||
"sha256": "21ecaab6976583d9c7330512ac2c47d747a9be178ea763d6d1f5a293174aaad5"
|
||||
},
|
||||
{
|
||||
"path": "skills/apify-js-sdk/references/index.md",
|
||||
"sha256": "b9fb61a2f21d4c22ad56a7d34d810823e53859a228d6cf7f8462e6c9194536ee"
|
||||
},
|
||||
{
|
||||
"path": "skills/apify-js-sdk/references/llms-full.md",
|
||||
"sha256": "34ebb11dd3bbe48731f9d3d13ee43b25c7add18ca446c56b36d47c0e99310260"
|
||||
}
|
||||
],
|
||||
"dirSha256": "a30c63e0b7d2c4f81027ffa80ea7a7aa9131a25af123b05ec2d18ce1bd126050"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
397
skills/apify-js-sdk/SKILL.md
Normal file
397
skills/apify-js-sdk/SKILL.md
Normal file
@@ -0,0 +1,397 @@
|
||||
---
|
||||
name: apify-js-sdk
|
||||
description: 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:
|
||||
|
||||
```javascript
|
||||
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:
|
||||
|
||||
```javascript
|
||||
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:
|
||||
|
||||
```javascript
|
||||
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:
|
||||
|
||||
```javascript
|
||||
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:
|
||||
|
||||
```python
|
||||
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:
|
||||
|
||||
```python
|
||||
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:
|
||||
|
||||
```javascript
|
||||
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:
|
||||
|
||||
```python
|
||||
from apify import Actor
|
||||
|
||||
async def main() -> None:
|
||||
async with Actor:
|
||||
# Default redirect logger
|
||||
await Actor.call(actor_id='some_actor_id')
|
||||
|
||||
# No redirect logger
|
||||
await Actor.call(actor_id='some_actor_id', logger=None)
|
||||
|
||||
# Custom redirect logger
|
||||
await Actor.call(
|
||||
actor_id='some_actor_id',
|
||||
logger=logging.getLogger('custom_logger')
|
||||
)
|
||||
```
|
||||
|
||||
### Getting Actor Run Details
|
||||
|
||||
Retrieve information about an Actor run:
|
||||
|
||||
```javascript
|
||||
import { ApifyClient } from 'apify-client';
|
||||
|
||||
const client = new ApifyClient({
|
||||
token: 'YOUR_API_TOKEN',
|
||||
});
|
||||
|
||||
// Get run details
|
||||
const run = await client.run('run-id').get();
|
||||
|
||||
console.log(`Status: ${run.status}`);
|
||||
console.log(`Started: ${run.startedAt}`);
|
||||
console.log(`Finished: ${run.finishedAt}`);
|
||||
```
|
||||
|
||||
### Listing Actor Builds
|
||||
|
||||
Get all builds for a specific Actor:
|
||||
|
||||
```javascript
|
||||
import { ApifyClient } from 'apify-client';
|
||||
|
||||
const client = new ApifyClient({
|
||||
token: 'YOUR_API_TOKEN',
|
||||
});
|
||||
|
||||
const { items } = await client.actor('actor-id').builds().list({
|
||||
limit: 10,
|
||||
desc: true,
|
||||
});
|
||||
|
||||
for (const build of items) {
|
||||
console.log(`Build ${build.buildNumber}: ${build.status}`);
|
||||
}
|
||||
```
|
||||
|
||||
## Reference Files
|
||||
|
||||
This skill includes comprehensive documentation in the `references/` directory:
|
||||
|
||||
### llms-txt.md
|
||||
Complete API reference documentation with detailed information on:
|
||||
- **Actor Management**: Creating, updating, and running Actors
|
||||
- **Builds**: Managing Actor builds and versions
|
||||
- **Runs**: Controlling Actor execution and monitoring
|
||||
- **Tasks**: Pre-configured Actor executions
|
||||
- **Datasets**: Structured data storage and retrieval
|
||||
- **Key-Value Stores**: Arbitrary data storage
|
||||
- **Request Queues**: URL queue management
|
||||
- **Client SDK**: JavaScript/Python client libraries
|
||||
- **Logging**: Configuring and managing logs
|
||||
|
||||
### llms-full.md
|
||||
Extensive documentation covering:
|
||||
- Complete Apify API v2 reference
|
||||
- All API endpoints with request/response examples
|
||||
- Authentication and rate limiting
|
||||
- Error handling
|
||||
- Webhooks and integrations
|
||||
|
||||
### llms.md
|
||||
High-level overview and getting started guide with:
|
||||
- Platform concepts and architecture
|
||||
- Quick start examples
|
||||
- Common patterns and workflows
|
||||
- Best practices for web scraping
|
||||
|
||||
## Working with This Skill
|
||||
|
||||
### For Beginners
|
||||
|
||||
Start with these concepts:
|
||||
1. **Understanding Actors**: Review the Actors introduction to learn about the core building block
|
||||
2. **First Scraper**: Use the link extraction examples to build your first web scraper
|
||||
3. **Data Storage**: Learn about Datasets and Key-Value Stores for storing results
|
||||
4. **API Basics**: Get familiar with the Apify Client for programmatic access
|
||||
|
||||
Key reference: `llms.md` for platform overview and getting started guides
|
||||
|
||||
### For Intermediate Users
|
||||
|
||||
Focus on these areas:
|
||||
1. **Advanced Crawling**: Implement request queues and link filtering
|
||||
2. **Actor Tasks**: Set up pre-configured runs with custom inputs
|
||||
3. **Logging**: Configure proper logging with ActorLogFormatter
|
||||
4. **Error Handling**: Implement retry logic and error recovery
|
||||
5. **Webhooks**: Set up notifications for Actor run events
|
||||
|
||||
Key reference: `llms-txt.md` for detailed API methods and parameters
|
||||
|
||||
### For Advanced Users
|
||||
|
||||
Explore these topics:
|
||||
1. **Actor Builds**: Manage versions and deployments
|
||||
2. **Metamorph**: Transform running Actors into different Actors
|
||||
3. **Custom Integrations**: Build complex workflows with the API
|
||||
4. **Performance Optimization**: Tune concurrency and resource usage
|
||||
5. **Multi-Actor Orchestration**: Chain multiple Actors together
|
||||
|
||||
Key reference: `llms-full.md` for complete API endpoint reference
|
||||
|
||||
### Navigation Tips
|
||||
|
||||
- **Search by concept**: Use keywords like "dataset", "actor", "build" to find relevant sections
|
||||
- **Check examples**: Look for code blocks in the documentation for working examples
|
||||
- **API endpoints**: All endpoints follow the pattern `/v2/{resource}/{action}`
|
||||
- **Client methods**: SDK methods mirror API endpoints (e.g., `client.actor().run()`)
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Web Scraping Workflow
|
||||
|
||||
1. Set up the crawler with initial URLs
|
||||
2. Extract links from pages
|
||||
3. Filter and enqueue new URLs
|
||||
4. Extract data from pages
|
||||
5. Store results in a dataset
|
||||
6. Handle errors and retries
|
||||
|
||||
### Actor Development Workflow
|
||||
|
||||
1. Create Actor locally or in Apify Console
|
||||
2. Write scraping logic with Cheerio/Puppeteer
|
||||
3. Test locally with sample data
|
||||
4. Build and deploy to Apify platform
|
||||
5. Create tasks for different configurations
|
||||
6. Monitor runs and debug issues
|
||||
|
||||
### Data Pipeline Pattern
|
||||
|
||||
1. Run an Actor to scrape data
|
||||
2. Store results in a dataset
|
||||
3. Call another Actor to process the data
|
||||
4. Export final results to external system
|
||||
5. Use webhooks to trigger next steps
|
||||
|
||||
## Resources
|
||||
|
||||
### Official Documentation
|
||||
- **API Reference**: Complete API v2 documentation at https://docs.apify.com/api/v2
|
||||
- **SDK Docs**: JavaScript and Python SDK documentation
|
||||
- **Academy**: Web scraping tutorials and best practices
|
||||
- **Examples**: Ready-to-use Actor templates
|
||||
|
||||
### Getting Help
|
||||
- Check the reference files for detailed API documentation
|
||||
- Review code examples for common patterns
|
||||
- Use the Apify Console for visual debugging
|
||||
- Monitor Actor runs with detailed logs
|
||||
|
||||
## Notes
|
||||
|
||||
- This skill was automatically generated from official Apify documentation
|
||||
- Reference files preserve structure and examples from source docs
|
||||
- Code examples include proper language detection for syntax highlighting
|
||||
- Documentation covers both JavaScript and Python SDKs
|
||||
- API version 2 is the current stable version
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always use API tokens** for authentication (never hardcode)
|
||||
2. **Handle rate limits** appropriately (respect platform quotas)
|
||||
3. **Store credentials securely** using Actor secrets
|
||||
4. **Log appropriately** (INFO for progress, DEBUG for details)
|
||||
5. **Clean up resources** (close stores/datasets when done)
|
||||
6. **Use request queues** for large-scale crawling
|
||||
7. **Implement retries** for failed requests
|
||||
8. **Monitor Actor memory** usage to prevent crashes
|
||||
|
||||
## Updating
|
||||
|
||||
To refresh this skill with updated documentation:
|
||||
1. Re-run the documentation scraper with the same configuration
|
||||
2. The skill will be rebuilt with the latest information
|
||||
3. Review the updated reference files for new features
|
||||
15
skills/apify-js-sdk/plugin.json
Normal file
15
skills/apify-js-sdk/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "apify-js-sdk",
|
||||
"description": "Interacts with the Apify JS SDK. Allows you to work with Actors and other Apify features.",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Tim Green",
|
||||
"email": "rawveg@gmail.com"
|
||||
},
|
||||
"homepage": "https://github.com/rawveg/claude-skills-marketplace",
|
||||
"repository": "https://github.com/rawveg/claude-skills-marketplace",
|
||||
"license": "MIT",
|
||||
"keywords": ["apify-js-sdk", "apify", "actors", "Claude Code"],
|
||||
"category": "productivity",
|
||||
"strict": false
|
||||
}
|
||||
7
skills/apify-js-sdk/references/index.md
Normal file
7
skills/apify-js-sdk/references/index.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Apify-Js-Sdk Documentation Index
|
||||
|
||||
## Categories
|
||||
|
||||
### Llms-Txt
|
||||
**File:** `llms-txt.md`
|
||||
**Pages:** 1113
|
||||
124672
skills/apify-js-sdk/references/llms-full.md
Normal file
124672
skills/apify-js-sdk/references/llms-full.md
Normal file
File diff suppressed because one or more lines are too long
88905
skills/apify-js-sdk/references/llms-txt.md
Normal file
88905
skills/apify-js-sdk/references/llms-txt.md
Normal file
File diff suppressed because one or more lines are too long
1073
skills/apify-js-sdk/references/llms.md
Normal file
1073
skills/apify-js-sdk/references/llms.md
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user