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/... |
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 identifiertitle-- Content titlechannel-- Channel or author namelanguage-- Detected language codeis_auto_generated-- Whether the transcript was auto-generatedsegment_count-- Number of transcript segmentssource-- 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
Metadata
Release files for langchain-trawl 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_trawl-0.1.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_trawl-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / langchain_trawl-0.1.0.tar.gz
| Download URL | langchain_trawl-0.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4630b26e0de6f55bb0ed05f2a2445434562b6342c86c22efdf66b755248a09d0
|
|
BLAKE2b-256 checksum How to use checksums |
4afbbbae8708257a5ae1cbd5cb9b735e6c176cc9a00300d9307ab3b25d37b433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 7, 2026.
Transparency logRelease files / langchain_trawl-0.1.0-py3-none-any.whl
| Download URL | langchain_trawl-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a29ed936a544bd906cd5f8f0fbd8b0eed09914f28d2ca29fe6a7b3c63f10eb4f
|
|
BLAKE2b-256 checksum How to use checksums |
ea07bcbc64ae00d6b8d36c5b0cfdd0c8b5182d8cff9b15643182a50730c4e8e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 7, 2026.
Transparency log