Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

[Bugfix] fix import youtube allowed netlocks by defining them locally (#1191)

Deven Patele572b5a3dc1b
diff --git a/embedchain/utils/misc.py b/embedchain/utils/misc.py
index 88732bb8d..0f117b32e 100644
--- a/embedchain/utils/misc.py
+++ b/embedchain/utils/misc.py
@@ -201,10 +201,16 @@ def detect_datatype(source: Any) -> DataType:
formatted_source = format_source(str(source), 30)
if url:
- from langchain.document_loaders.youtube import \
- ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS
+ YOUTUBE_ALLOWED_NETLOCKS = {
+ "www.youtube.com",
+ "m.youtube.com",
+ "youtu.be",
+ "youtube.com",
+ "vid.plus",
+ "www.youtube-nocookie.com",
+ }
- if url.netloc in YOUTUBE_ALLOWED_NETLOCS:
+ if url.netloc in YOUTUBE_ALLOWED_NETLOCKS:
logging.debug(f"Source of `{formatted_source}` detected as `youtube_video`.")
return DataType.YOUTUBE_VIDEO