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.1.tar.gz (7.7 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.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for trawl_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 15e48ed86bd9da2c950a7442552544d1c6aec368b53627966b1ea2374aa4af11
MD5 c68455f7614ce38da4e6fac12f80715a
BLAKE2b-256 8615bef74ebb3282d02b6658457700a6992006e8b685286dffec8dce9bc7ef31

See more details on using hashes here.

Provenance

The following attestation bundles were made for trawl_sdk-0.1.1.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.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for trawl_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90b4ac1c3461edeb1273ec7fedf2464d2ac4f3500760401cd54e0dbec90b0681
MD5 8cd09aa5847821a7e86d62c13572d5ab
BLAKE2b-256 3fe40938109d274f6bd1f5a6a72185609ea6350ed90c0980a7fed3433c69b42d

See more details on using hashes here.

Provenance

The following attestation bundles were made for trawl_sdk-0.1.1-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