Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat(parse): support larkoffice.com Feishu document URLs (#1684)

efish3069b4bad81c
diff --git a/openviking/parse/accessors/feishu_accessor.py b/openviking/parse/accessors/feishu_accessor.py
index e92f8214d..1b8cf272b 100644
--- a/openviking/parse/accessors/feishu_accessor.py
+++ b/openviking/parse/accessors/feishu_accessor.py
@@ -256,7 +256,11 @@ class FeishuAccessor(DataAccessor):
parsed = urlparse(url)
host = parsed.hostname or ""
path = parsed.path
- is_feishu_domain = host.endswith(".feishu.cn") or host.endswith(".larksuite.com")
+ is_feishu_domain = (
+ host.endswith(".feishu.cn")
+ or host.endswith(".larksuite.com")
+ or host.endswith(".larkoffice.com")
+ )
has_doc_path = any(
path == f"/{t}" or path.startswith(f"/{t}/") for t in ("docx", "wiki", "sheets", "base")
)
diff --git a/openviking/parse/parsers/feishu.py b/openviking/parse/parsers/feishu.py
index ff756c03e..12f1c9176 100644
--- a/openviking/parse/parsers/feishu.py
+++ b/openviking/parse/parsers/feishu.py
@@ -33,7 +33,7 @@ from openviking_cli.utils.logger import get_logger
logger = get_logger(__name__)
-_ALLOWED_FEISHU_HOSTS = ("feishu.cn", "larksuite.com")
+_ALLOWED_FEISHU_HOSTS = ("feishu.cn", "larksuite.com", "larkoffice.com")
def _getattr_safe(obj, key: str, default=None):
diff --git a/tests/parse/test_feishu_parser.py b/tests/parse/test_feishu_parser.py
index a94d40a32..fff9655d7 100644
--- a/tests/parse/test_feishu_parser.py
+++ b/tests/parse/test_feishu_parser.py
@@ -125,6 +125,13 @@ class TestIsFeishuUrl:
"https://example.larksuite.com/sheets/abc123"
)
+ def test_larkoffice(self):
+ from openviking.utils.media_processor import UnifiedResourceProcessor
+
+ assert UnifiedResourceProcessor._is_feishu_url(
+ "https://example.larkoffice.com/wiki/wikicn123"
+ )
+
def test_non_feishu_url(self):
from openviking.utils.media_processor import UnifiedResourceProcessor
@@ -625,6 +632,30 @@ class TestParseAsyncIntegration:
assert result.meta["feishu_doc_type"] == "docx"
assert result.meta["feishu_token"] == "real_token"
+ def test_parse_content_routes_larkoffice_url(self):
+ """Test that parse_content routes larkoffice.com URLs to FeishuParser.parse() correctly."""
+ parser = FeishuParser()
+
+ # Mock the underlying parse() method to avoid network/SDK calls
+ mock_result = MagicMock()
+ mock_result.source_format = "feishu_docx"
+ mock_result.meta = {"feishu_token": "larkoffice123"}
+
+ async def _mock_parse(*a, **kw):
+ return mock_result
+
+ parser.parse = _mock_parse
+
+ result = asyncio.get_event_loop().run_until_complete(
+ parser.parse_content(
+ content="",
+ source_path="https://bytedance.larkoffice.com/wiki/larkoffice123"
+ )
+ )
+
+ assert result.source_format == "feishu_docx"
+ assert result.meta["feishu_token"] == "larkoffice123"
+
def test_parse_unsupported_type(self):
"""Test that unsupported document types return error ParseResult."""
parser = FeishuParser()