Skip to main content

Python SDK for the Trawl unified content API

Project description

Trawl Python SDK

The official Python SDK for the Trawl API — extract transcripts from YouTube, podcasts, TikTok, earnings calls, SEC filings, news, and academic papers.

Install

pip install trawl

Quick Start

from trawl import TrawlClient

client = TrawlClient(api_key="trawl_your_key")

# Search YouTube
results = client.search.youtube("machine learning tutorial", max_results=5)
for video in results.results:
    print(f"{video.title}{video.channel}")

# Extract a transcript
transcript = client.transcripts.extract("https://youtube.com/watch?v=dQw4w9WgXcQ")
print(f"{len(transcript.segments)} segments extracted")

# Preview without auth (free)
preview = client.transcripts.preview("https://youtube.com/watch?v=dQw4w9WgXcQ")

# Bulk download as ZIP
zip_bytes = client.bulk.download(["dQw4w9WgXcQ", "9bZkp7q19f0"], format="jsonl")

All Resources

client = TrawlClient(api_key="trawl_your_key")

# YouTube
client.search.youtube(query, max_results=10)
client.transcripts.extract(url, language=None)
client.transcripts.preview(url)              # No auth needed
client.transcripts.download(id, format="txt")
client.bulk.download(video_ids, format="txt") # No auth needed

# Podcasts
client.search.podcasts(query, max_results=20)
client.podcasts.episodes(podcast_id)
client.podcasts.transcribe(audio_url)

# Earnings Calls
client.earnings.search("AAPL")
client.earnings.get_transcript("AAPL", 2026, 1)
client.earnings.get_chunks("AAPL", 2026, 1)

# SEC Filings
client.filings.search("AAPL", form_type="10-K")

# News (GDELT)
client.news.search("Federal Reserve", language="en")
client.news.get_article_text("https://example.com/article")

# Academic Papers
client.papers.search("transformer architecture")
client.papers.extract(arxiv_id="2301.08745")

# AI Analysis
client.ai.summarize(transcript_id)
client.ai.topics(transcript_id)
client.ai.entities(transcript_id)
client.ai.preview_summarize("Raw text to summarize")  # No auth

# Jobs
client.jobs.get(job_id)
client.jobs.list()

Error Handling

from trawl.exceptions import (
    TrawlError,
    AuthenticationError,  # 401
    NotFoundError,        # 404
    RateLimitError,       # 429
    ValidationError,      # 422
)

try:
    transcript = client.transcripts.extract("invalid-url")
except ValidationError as e:
    print(f"Bad request: {e}")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except AuthenticationError:
    print("Invalid API key")

Context Manager

with TrawlClient(api_key="trawl_your_key") as client:
    results = client.search.youtube("python")
    # client.close() called automatically

Requirements

  • Python 3.10+
  • httpx

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trawl_sdk-0.1.4.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trawl_sdk-0.1.4-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file trawl_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: trawl_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trawl_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 bf983bdc9a389282f03d441fe2be29dd8dcf7c9d4d9c4a95a76d7c6540eb9ba2
MD5 de5f63a04542d9ed4fc3187644b49b88
BLAKE2b-256 b53e4ed4ecbaeda873347279c2c88d06aa1300d6b27c0dca35706efccbff5be0

See more details on using hashes here.

Provenance

The following attestation bundles were made for trawl_sdk-0.1.4.tar.gz:

Publisher: release.yml on d3vind/youtube-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trawl_sdk-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: trawl_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trawl_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9151ed7da98e7a9289e3fd0bb746100bb3b6d40a4c611c6f4e6e5cf16770e057
MD5 a6e5c3a11f4f0169de669cc9ff110ce1
BLAKE2b-256 d9c4c8425843fb487cec2728fa543191fcfa63cfeb4fb343a9764fef6163ffb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for trawl_sdk-0.1.4-py3-none-any.whl:

Publisher: release.yml on d3vind/youtube-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page