소스 검색

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

Co-authored-by: Deven Patel <deven298@yahoo.com>
Deven Patel 1 년 전
부모
커밋
e572b5a3dc
1개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      embedchain/utils/misc.py

+ 9 - 3
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