Metadata-Version: 2.4
Name: supadata
Version: 1.0.0
Summary: The official Python SDK for Supadata - scrape web content and YouTube transcripts with ease
Project-URL: homepage, https://supadata.ai
Project-URL: repository, https://github.com/supadata/supadata-py
Project-URL: documentation, https://supadata.ai/documentation
Author-email: Supadata <support@supadata.ai>
License-Expression: MIT
License-File: LICENSE
Keywords: ai,api,llm,supadata,transcripts,web-scraping,youtube
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: requests>=2.28.1
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == 'test'
Requires-Dist: requests-mock>=1.11.0; extra == 'test'
Description-Content-Type: text/markdown

# Supadata Python SDK

[![PyPI version](https://badge.fury.io/py/supadata.svg)](https://badge.fury.io/py/supadata)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT)

The official Python SDK for Supadata.

Get your free API key at [supadata.ai](https://supadata.ai) and start scraping data in minutes.

## Installation

```bash
pip install supadata
```

## Usage

```python
from supadata import Supadata

# Initialize the client
client = Supadata(api_key="YOUR_API_KEY")

# Get YouTube transcript
transcript = client.get_transcript(video_id="VIDEO_ID")
print(f"Got transcript in {transcript['lang']}")

# Translate YouTube transcript to Spanish
translated = client.translate_transcript(
    video_id="VIDEO_ID",
    lang="es"
)
print(f"Got translated transcript in {translated['lang']}")

# Get plain text transcript
text_transcript = client.get_transcript(
    video_id="VIDEO_ID",
    text=True
)
print(text_transcript['content'])

# Scrape web content
web_content = client.scrape("https://supadata.ai")
print(f"Page title: {web_content['name']}")
print(f"Content length: {web_content['countCharacters']} characters")

# Map website URLs
site_map = client.map("https://supadata.ai")
print(f"Found {len(site_map['urls'])} URLs")
```

## Error Handling

The SDK uses the standard `requests` library and will raise `requests.exceptions.RequestException` for API-related errors:

```python
from requests.exceptions import RequestException

try:
    transcript = client.get_transcript(video_id="INVALID_ID")
except RequestException as error:
    print(f"API request failed: {error}")
    if error.response is not None:
        error_data = error.response.json()
        print(f"Error code: {error_data.get('code')}")
        print(f"Error title: {error_data.get('title')}")
        print(f"Error description: {error_data.get('description')}")
```

## API Reference

See the [Documentation](https://supadata.ai/documentation) for more details on all possible parameters and options.

## License

MIT
