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/... |
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4630b26e0de6f55bb0ed05f2a2445434562b6342c86c22efdf66b755248a09d0
|
|
| MD5 |
42cb435955e987c8f7331c5be56f6706
|
|
| BLAKE2b-256 |
4afbbbae8708257a5ae1cbd5cb9b735e6c176cc9a00300d9307ab3b25d37b433
|
Provenance
The following attestation bundles were made for langchain_trawl-0.1.0.tar.gz:
Publisher:
publish-langchain.yml on d3vind/youtube-transcript
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_trawl-0.1.0.tar.gz -
Subject digest:
4630b26e0de6f55bb0ed05f2a2445434562b6342c86c22efdf66b755248a09d0 - Sigstore transparency entry: 1247481239
- Sigstore integration time:
-
Permalink:
d3vind/youtube-transcript@274ab95cffb53100a0d4ae8d632fa4acc31749cc -
Branch / Tag:
refs/tags/langchain-v0.1.0 - Owner: https://github.com/d3vind
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-langchain.yml@274ab95cffb53100a0d4ae8d632fa4acc31749cc -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_trawl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_trawl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a29ed936a544bd906cd5f8f0fbd8b0eed09914f28d2ca29fe6a7b3c63f10eb4f
|
|
| MD5 |
812109832a70803f757c840a89b9d5a1
|
|
| BLAKE2b-256 |
ea07bcbc64ae00d6b8d36c5b0cfdd0c8b5182d8cff9b15643182a50730c4e8e9
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_trawl-0.1.0-py3-none-any.whl -
Subject digest:
a29ed936a544bd906cd5f8f0fbd8b0eed09914f28d2ca29fe6a7b3c63f10eb4f - Sigstore transparency entry: 1247481244
- Sigstore integration time:
-
Permalink:
d3vind/youtube-transcript@274ab95cffb53100a0d4ae8d632fa4acc31749cc -
Branch / Tag:
refs/tags/langchain-v0.1.0 - Owner: https://github.com/d3vind
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-langchain.yml@274ab95cffb53100a0d4ae8d632fa4acc31749cc -
Trigger Event:
push
-
Statement type: