fix(bilibili): avoid nested asyncio.run() in async context

BilibiliAdapter._fetch_metadata_with_retry() now calls the underlying
async methods directly instead of sync wrappers that use asyncio.run().
This prevents "asyncio.run() cannot be called from a running event loop"
error when the adapter is called from within an already-running event loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 18:15:32 +08:00
parent f7569af007
commit 368e946cd1
+4 -2
View File
@@ -170,9 +170,11 @@ class BilibiliAdapter(PlatformAdapter):
ValueError: If content_type is not supported
"""
if content_type == "video":
return self._extractor.extract_video_metadata(content_id)
# Call async method directly to avoid nested asyncio.run()
return await self._extractor._extract_video_async(content_id)
elif content_type == "article":
return self._extractor.extract_article_metadata(content_id)
# Call async method directly to avoid nested asyncio.run()
return await self._extractor._extract_article_async(content_id)
else:
raise ValueError(f"Unsupported content type: {content_type}")