Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supadata-ai/js
Official TypeScript/JavaScript SDK for the Supadata API.
https://github.com/supadata-ai/js
ai crawler llm markdown scraper transcript web-crawler youtube
Last synced: 2 days ago
JSON representation
Official TypeScript/JavaScript SDK for the Supadata API.
- Host: GitHub
- URL: https://github.com/supadata-ai/js
- Owner: supadata-ai
- Created: 2025-01-26T22:57:08.000Z (3 days ago)
- Default Branch: main
- Last Pushed: 2025-01-27T09:24:10.000Z (2 days ago)
- Last Synced: 2025-01-27T14:48:44.515Z (2 days ago)
- Topics: ai, crawler, llm, markdown, scraper, transcript, web-crawler, youtube
- Language: TypeScript
- Homepage: https://supadata.ai
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Supadata JS SDK
[![NPM package](https://img.shields.io/npm/v/@supadata/js.svg?branch=main)](https://www.npmjs.com/package/@supadata/js)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT)The official TypeScript/JavaScript SDK for Supadata.
Get your free API key at [supadata.ai](https://supadata.ai) and start scraping data in minutes.
## Installation
```bash
npm install @supadata/js
```## Usage
```typescript
import { Supadata, Transcript } from '@supadata/js';// Initialize the client
const supadata = new Supadata({
apiKey: 'YOUR_API_KEY',
});// Get YouTube transcript
const transcript = await supadata.youtube.transcript({
videoId: 'VIDEO_ID',
});// Translate YouTube transcript
const translated = await supadata.youtube.translate({
videoId: 'VIDEO_ID',
lang: 'es',
});// Scrape web content
const webContent = await supadata.web.scrape('https://supadata.ai');// Map website URLs
const siteMap = await supadata.web.map('https://supadata.ai');
```## Error Handling
The SDK throws `SupadataError` for API-related errors. You can catch and handle these errors as follows:
```typescript
import { SupadataError } from '@supadata/js';try {
const transcript = await supadata.youtube.transcript({
videoId: 'INVALID_ID',
});
} catch (error) {
if (error instanceof SupadataError) {
console.error(error.code); // e.g., 'video-not-found'
console.error(error.title); // Human readable error title
console.error(error.message); // Detailed error description
console.error(error.documentationUrl); // Link to error documentation
}
}
```## API Reference
See the [Documentation](https://supadata.ai/documentation) for more details on all possible parameters and options.
## License
MIT