Skip to content

The agent engineering platform.

community: Fix attribute access for transcript text in YoutubeLoader (Fixes #30309) (#30582)

Armaanjeet Singh Sandhu4bbc249b134a
diff --git a/libs/community/langchain_community/document_loaders/youtube.py b/libs/community/langchain_community/document_loaders/youtube.py
index eeecad1af3..5b9dfe8736 100644
--- a/libs/community/langchain_community/document_loaders/youtube.py
+++ b/libs/community/langchain_community/document_loaders/youtube.py
@@ -272,7 +272,14 @@ class YoutubeLoader(BaseLoader):
transcript = transcript.translate(self.translation)
transcript_object = transcript.fetch()
if isinstance(transcript_object, FetchedTranscript):
- transcript_pieces = [{"text": x.text} for x in transcript_object.snippets]
+ transcript_pieces = [
+ {
+ "text": snippet.text,
+ "start": snippet.start,
+ "duration": snippet.duration,
+ }
+ for snippet in transcript_object.snippets
+ ]
else:
transcript_pieces: List[Dict[str, Any]] = transcript_object # type: ignore[no-redef]
diff --git a/libs/community/uv.lock b/libs/community/uv.lock
index 91ccbf4f44..99a14abe52 100644
--- a/libs/community/uv.lock
+++ b/libs/community/uv.lock
@@ -1492,7 +1492,7 @@ wheels = [
[[package]]
name = "langchain"
-version = "0.3.21"
+version = "0.3.22"
source = { editable = "../langchain" }
dependencies = [
{ name = "async-timeout", marker = "python_full_version < '3.11'" },
@@ -1747,7 +1747,7 @@ typing = [
[[package]]
name = "langchain-core"
-version = "0.3.47"
+version = "0.3.49"
source = { editable = "../core" }
dependencies = [
{ name = "jsonpatch" },
@@ -1777,7 +1777,7 @@ dev = [
{ name = "jupyter", specifier = ">=1.0.0,<2.0.0" },
{ name = "setuptools", specifier = ">=67.6.1,<68.0.0" },
]
-lint = [{ name = "ruff", specifier = ">=0.9.2,<1.0.0" }]
+lint = [{ name = "ruff", specifier = ">=0.11.2,<0.12.0" }]
test = [
{ name = "blockbuster", specifier = "~=1.5.18" },
{ name = "freezegun", specifier = ">=1.2.2,<2.0.0" },
@@ -1805,7 +1805,7 @@ typing = [
[[package]]
name = "langchain-tests"
-version = "0.3.15"
+version = "0.3.17"
source = { editable = "../standard-tests" }
dependencies = [
{ name = "httpx" },