Skip to main content

LangChain integration for the Trawl unified content API — transcripts from 10+ sources

Project description

langchain-trawl

LangChain integration for the Trawl unified content API. Extract transcripts and text from 10+ sources as LangChain Document objects, ready for RAG pipelines, summarization chains, and more.

Installation

pip install langchain-trawl

This installs langchain-core and trawl-sdk as dependencies.

Quick Start

from langchain_trawl import TrawlLoader

loader = TrawlLoader(
    urls=["https://youtube.com/watch?v=dQw4w9WgXcQ"],
    api_key="trawl_...",  # or set TRAWL_API_KEY env var
)
docs = loader.load()

print(docs[0].page_content[:200])
print(docs[0].metadata)
# {'video_id': 'dQw4w9WgXcQ', 'title': '...', 'channel': '...', ...}

Supported Sources

Source Example URL
YouTube https://youtube.com/watch?v=...
Podcasts https://podcasts.apple.com/... or RSS feed URL
TikTok https://tiktok.com/@user/video/...
Instagram Reels https://instagram.com/reel/...
Twitter/X Spaces https://twitter.com/i/spaces/...
Reddit https://reddit.com/r/sub/comments/...
News Articles Any news article URL
Earnings Calls Ticker symbol via Trawl API
SEC Filings EDGAR filing URLs
Academic Papers ArXiv or DOI URLs

Parameters

Parameter Type Default Description
urls list[str] required URLs to extract content from
api_key str | None None Trawl API key (falls back to TRAWL_API_KEY env var)
language str | None None Language code filter (e.g. "en", "es")
base_url str "https://api.gettrawl.com" API base URL

Document Metadata

Each loaded document includes these metadata fields:

  • video_id -- Source content identifier
  • title -- Content title
  • channel -- Channel or author name
  • language -- Detected language code
  • is_auto_generated -- Whether the transcript was auto-generated
  • segment_count -- Number of transcript segments
  • source -- Original URL

If extraction fails, the document will have empty page_content and an error key in metadata.

Use in RAG Pipelines

from langchain_trawl import TrawlLoader
from langchain_openai import OpenAIEmbeddings
from langchain_community.vectorstores import FAISS
from langchain.text_splitter import RecursiveCharacterTextSplitter

# Load transcripts
loader = TrawlLoader(
    urls=[
        "https://youtube.com/watch?v=video1",
        "https://youtube.com/watch?v=video2",
    ],
)
docs = loader.load()

# Split and embed
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
chunks = splitter.split_documents(docs)
vectorstore = FAISS.from_documents(chunks, OpenAIEmbeddings())

# Query
results = vectorstore.similarity_search("your question here")

Development

# Install dependencies
poetry install

# Run tests
make test

# Lint and format
make lint
make format

License

MIT

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

langchain_trawl-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

langchain_trawl-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file langchain_trawl-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for langchain_trawl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4630b26e0de6f55bb0ed05f2a2445434562b6342c86c22efdf66b755248a09d0
MD5 42cb435955e987c8f7331c5be56f6706
BLAKE2b-256 4afbbbae8708257a5ae1cbd5cb9b735e6c176cc9a00300d9307ab3b25d37b433

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_trawl-0.1.0.tar.gz:

Publisher: publish-langchain.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 langchain_trawl-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_trawl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a29ed936a544bd906cd5f8f0fbd8b0eed09914f28d2ca29fe6a7b3c63f10eb4f
MD5 812109832a70803f757c840a89b9d5a1
BLAKE2b-256 ea07bcbc64ae00d6b8d36c5b0cfdd0c8b5182d8cff9b15643182a50730c4e8e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_trawl-0.1.0-py3-none-any.whl:

Publisher: publish-langchain.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