nexract
v2.0.0
Published
Nexract — Web Intelligence API SDK. Extract, analyze, and monitor any webpage. Built-in OpenAI, Claude, and LangChain integrations.
Maintainers
Readme
Nexract — Web Intelligence API SDK
Extract, analyze, and monitor any webpage with one API call.
Features
- Extract clean markdown from any public URL
- AI Analysis — summary, sentiment, entities, categories (powered by Claude)
- Batch Extract — up to 10 URLs in one request
- Schema Extraction — custom JSON schema for structured data
- OpenAI Tool — built-in function calling definition
- Claude Tool — built-in Anthropic tool definition
- Content Filtering — max_words, no_links, first_paragraphs
- Retry Logic — automatic exponential backoff for 429/503
- TypeScript — full type definitions included
- Arabic Intelligence — dialect detection, bilingual analysis
Install
npm install nexractQuick Start
const { Nexract } = require('nexract');
const nx = new Nexract('SK-LAB-YOUR-KEY');
// Basic extraction (1 credit)
const result = await nx.extract('https://example.com/article');
console.log(result.data); // Clean markdown
console.log(result.title); // Article title
console.log(result.wordCount); // Word count
// With AI analysis (+2 credits)
const ai = await nx.extract('https://bbc.com/article', { ai: true });
console.log(ai.summary); // AI-generated summary
console.log(ai.sentiment); // positive/negative/neutral
// Batch extract (up to 10 URLs)
const batch = await nx.batchExtract([
'https://site1.com', 'https://site2.com', 'https://site3.com'
]);
console.log(`${batch.successful} succeeded, ${batch.failed} failed`);
// Check balance
const bal = await nx.balance();
console.log(`Credits: ${bal.balance}`);OpenAI Integration
const OpenAI = require('openai');
const { Nexract } = require('nexract');
const nx = new Nexract('SK-LAB-YOUR-KEY');
const openai = new OpenAI();
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Summarize https://example.com' }],
tools: [nx.openaiTool()], // One line!
});
for (const call of response.choices[0].message.tool_calls || []) {
const content = await nx.handleToolCall(JSON.parse(call.function.arguments));
console.log(content);
}Claude Integration
const Anthropic = require('@anthropic-ai/sdk');
const { Nexract } = require('nexract');
const nx = new Nexract('SK-LAB-YOUR-KEY');
const claude = new Anthropic();
const response = await claude.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
tools: [nx.claudeTool()], // One line!
messages: [{ role: 'user', content: 'Extract https://example.com' }],
});
for (const block of response.content) {
if (block.type === 'tool_use') {
const content = await nx.handleToolCall(block.input);
console.log(content);
}
}API Reference
| Method | Description |
|--------|-------------|
| nx.extract(url, options?) | Extract a webpage (1 credit) |
| nx.batchExtract(urls, options?) | Extract multiple URLs (1 credit each) |
| nx.balance() | Check credit balance |
| nx.openaiTool() | OpenAI function calling definition |
| nx.claudeTool() | Anthropic Claude tool definition |
| nx.handleToolCall(args) | Handle AI tool call → returns content string |
Options
nx.extract(url, {
format: 'markdown', // 'markdown' | 'html' | 'text'
ai: false, // Enable AI analysis (+2 credits)
schema: null, // Custom extraction schema (+2 credits)
language: 'auto', // 'auto' | 'ar' | 'en' | etc.
selector: 'auto', // CSS selector for targeted extraction
});Links
- Website: nexract.ai
- API Docs: nexract.ai/docs.html
- Swagger UI: nexract.ai/api/docs
- Integrations: nexract.ai/integrations.html
License
MIT
