NB Scraper Documentation - v1.1.6
    Preparing search index...

    NB Scraper Documentation - v1.1.6

    NB Scraper

    NPM TypeScript License: Unlicense Codacy Badge CI/CD Pipeline

    A comprehensive TypeScript scraper library by NB Team that provides easy-to-use functions for interact with various scraper service from NB Scripts.

    Using npm:

    npm install nb-scraper
    

    Using yarn:

    yarn add nb-scraper
    

    Using pnpm:

    pnpm add nb-scraper
    
    import { blackboxAi, threads } from 'nb-scraper';

    // Scrape BlackBox AI
    const aiResult = await blackboxAi('What is TypeScript?');
    if (aiResult.status) {
    console.log('AI Response:', aiResult.data.response);
    console.log('Sources:', aiResult.data.source);
    } else {
    console.error('Error:', aiResult.error);
    }

    // Scrape Threads media
    const mediaResult = await threads('https://www.threads.net/@username/post/123456789');
    if (mediaResult.status) {
    console.log('Images:', mediaResult.data.image_urls);
    console.log('Videos:', mediaResult.data.video_urls);
    } else {
    console.error('Error:', mediaResult.error);
    }
    const { blackboxAi, threads } = require('nb-scraper');

    // Same usage as above
    (async () => {
    const result = await blackboxAi('Hello World');
    console.log(result);
    })();
    {
    creator: "...",
    status: true,
    data: {
    response: "TypeScript is a programming language...",
    source: [
    {
    link: "https://example.com",
    title: "TypeScript Documentation",
    snippet: "TypeScript is...",
    position: 1
    }
    ]
    }
    }
    {
    creator: "NB Team",
    status: false,
    error: "[NETWORK_ERROR] Request timeout after 30000ms"
    }

    NB Scraper is designed to never throw errors. Instead, all functions return a response object with a status field:

    const result = await blackboxAi('test query');

    if (result.status) {
    // Success - use result.data
    console.log(result.data.response);
    } else {
    // Error - check result.error
    console.error(result.error);
    }

    Common error types:

    • NETWORK_ERROR: Connection, timeout, or server issues
    • INVALID_INPUT: Invalid parameters or URL format
    • INVALID_RESPONSE: Unexpected response format from API
    • RATE_LIMITED: Rate limiting or quota exceeded
    • SERVICE_UNAVAILABLE: Service temporarily unavailable

    See The scrapers folder

    This project is licensed under the Unlicense – see the LICENSE file for details.

    This project is designed to be easy to use.

    Made with ☕