A comprehensive TypeScript scraper library by NB Team that provides easy-to-use functions for interact with various scraper service from NB Scripts.
daffa |
Fongsi |
Alex |
Lemon |
NajmyW |
Yogi Priyan Perdana |
[!NOTE] If your name appears in the repositoryβs
app/scrapers
folder, submit your GitHub username via an issue or pull request to be added to this contributor list.
Untuk update terbaru, dukungan, dan sumber daya scraping terbaik, ikuti saluran resmi kami:
NB SCRAPER di WhatsApp:
Join Channel
This project is designed to be easy to use. Visit the WhatsApp Channel for the code resources
π½ Want to Include Your Scraper?
- Fork the repository here
- Create a new branch
-
Add your scraper function on
app/scrapers/
-
Add your types on
app/types.ts
-
Add comprehensive tests in
integration-tests/
(optional) - Submit a pull request
Pro Tip: Join our WhatsApp Channel for contribution support!
[!IMPORTANT] If you encounter an error while using the library or are confused about adding your own scraper, feel free to open an issue.
Using npm:
npm install nb-scraper
Using yarn:
yarn add nb-scraper
Using pnpm:
pnpm add nb-scraper
ESM Support
import { generateDeepInfraResponse } from 'nb-scraper';
const result = await generateDeepInfraResponse({
prompt: "Explain JavaScript in simple terms",
model: "deepseek-ai/DeepSeek-R1"
});
if (result.status) {
console.log(result.data.response);
}
CommonJS Support
const { generateDeepInfraResponse } = require('nb-scraper');
// Same usage as above
(async () => {
const result = await generateDeepInfraResponse('What the meaning of Pahlawan Indonesia?');
console.log(result);
})();
[!TIP] For detailed functions and examples, see the documentation at nb-scraper.js.org
NB Scraper is designed to never throw errors. Instead, all functions return a response object with a status
field:
const result = await generateDeepInfraResponse('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 ERROR TYPES
See The scrapers folder
This project is licensed under the Unlicense β see the LICENSE file for details.