supadata


Namesupadata JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryThe official Python SDK for Supadata - scrape web content and YouTube transcripts with ease
upload_time2025-01-27 14:20:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords ai api llm supadata transcripts web-scraping youtube
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
supadata = Supadata(api_key="YOUR_API_KEY")

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

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

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

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

# Map website URLs
site_map = supadata.web.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 = supadata.youtube.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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "supadata",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "ai, api, llm, supadata, transcripts, web-scraping, youtube",
    "author": null,
    "author_email": "Supadata <support@supadata.ai>",
    "download_url": "https://files.pythonhosted.org/packages/77/4b/ea63721a183f0e7b8012f047fca52f0900c305e08d40b019ed3ab5876ca1/supadata-1.0.2.tar.gz",
    "platform": null,
    "description": "# Supadata Python SDK\n\n[![PyPI version](https://badge.fury.io/py/supadata.svg)](https://badge.fury.io/py/supadata)\n[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT)\n\nThe official Python SDK for Supadata.\n\nGet your free API key at [supadata.ai](https://supadata.ai) and start scraping data in minutes.\n\n## Installation\n\n```bash\npip install supadata\n```\n\n## Usage\n\n```python\nfrom supadata import Supadata\n\n# Initialize the client\nsupadata = Supadata(api_key=\"YOUR_API_KEY\")\n\n# Get YouTube transcript\ntranscript = supadata.youtube.transcript(video_id=\"VIDEO_ID\")\nprint(f\"Got transcript in {transcript['lang']}\")\n\n# Translate YouTube transcript to Spanish\ntranslated = supadata.youtube.translate(\n    video_id=\"VIDEO_ID\",\n    lang=\"es\"\n)\nprint(f\"Got translated transcript in {translated['lang']}\")\n\n# Get plain text transcript\ntext_transcript = supadata.youtube.transcript(\n    video_id=\"VIDEO_ID\",\n    text=True\n)\nprint(text_transcript['content'])\n\n# Scrape web content\nweb_content = supadata.web.scrape(\"https://supadata.ai\")\nprint(f\"Page title: {web_content['name']}\")\nprint(f\"Content length: {web_content['count_characters']} characters\")\n\n# Map website URLs\nsite_map = supadata.web.map(\"https://supadata.ai\")\nprint(f\"Found {len(site_map['urls'])} URLs\")\n```\n\n## Error Handling\n\nThe SDK uses the standard `requests` library and will raise `requests.exceptions.RequestException` for API-related errors:\n\n```python\nfrom requests.exceptions import RequestException\n\ntry:\n    transcript = supadata.youtube.transcript(video_id=\"INVALID_ID\")\nexcept RequestException as error:\n    print(f\"API request failed: {error}\")\n    if error.response is not None:\n        error_data = error.response.json()\n        print(f\"Error code: {error_data.get('code')}\")\n        print(f\"Error title: {error_data.get('title')}\")\n        print(f\"Error description: {error_data.get('description')}\")\n```\n\n## API Reference\n\nSee the [Documentation](https://supadata.ai/documentation) for more details on all possible parameters and options.\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The official Python SDK for Supadata - scrape web content and YouTube transcripts with ease",
    "version": "1.0.2",
    "project_urls": {
        "documentation": "https://supadata.ai/documentation",
        "homepage": "https://supadata.ai",
        "repository": "https://github.com/supadata/py"
    },
    "split_keywords": [
        "ai",
        " api",
        " llm",
        " supadata",
        " transcripts",
        " web-scraping",
        " youtube"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "09c6cde5ca7866362915a0d98012abd9b17f1db9d181d910c8744848a17c1526",
                "md5": "f8e38f0d007755dc71ab26144c649358",
                "sha256": "8a7a9956a5f37c4524629a154deb2059e3b56bec666793df4542a903357e3923"
            },
            "downloads": -1,
            "filename": "supadata-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f8e38f0d007755dc71ab26144c649358",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7048,
            "upload_time": "2025-01-27T14:20:50",
            "upload_time_iso_8601": "2025-01-27T14:20:50.890524Z",
            "url": "https://files.pythonhosted.org/packages/09/c6/cde5ca7866362915a0d98012abd9b17f1db9d181d910c8744848a17c1526/supadata-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "774bea63721a183f0e7b8012f047fca52f0900c305e08d40b019ed3ab5876ca1",
                "md5": "f45218e782d53cc2cd750e49126a039b",
                "sha256": "a912d4416648b85b1455b4d894b0b893bcbf4b2c1852109e9b6990b818ef5cce"
            },
            "downloads": -1,
            "filename": "supadata-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f45218e782d53cc2cd750e49126a039b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6282,
            "upload_time": "2025-01-27T14:20:52",
            "upload_time_iso_8601": "2025-01-27T14:20:52.905147Z",
            "url": "https://files.pythonhosted.org/packages/77/4b/ea63721a183f0e7b8012f047fca52f0900c305e08d40b019ed3ab5876ca1/supadata-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-27 14:20:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "supadata",
    "github_project": "py",
    "github_not_found": true,
    "lcname": "supadata"
}
        
Elapsed time: 0.57257s