Merge pull request 'fix/ci-deploy-reset' (#10) from fix/ci-deploy-reset into main
Deploy kb-skills / deploy (push) Successful in 2s
Deploy kb-skills / deploy (push) Successful in 2s
Reviewed-on: http://192.168.1.22:8418/starmen1265/kb-skills/pulls/10
This commit was merged in pull request #10.
This commit is contained in:
@@ -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}")
|
||||
|
||||
|
||||
@@ -215,7 +215,21 @@ class DownloadProcessor(BaseProcessor):
|
||||
|
||||
# Bilibili video duration
|
||||
if "metadata" in metadata and "duration" in metadata["metadata"]:
|
||||
return metadata["metadata"]["duration"]
|
||||
duration = metadata["metadata"]["duration"]
|
||||
# Handle formatted duration string (e.g., "12:34" or "01:23:45")
|
||||
if isinstance(duration, str):
|
||||
if not duration.strip():
|
||||
return None
|
||||
parts = duration.split(':')
|
||||
try:
|
||||
if len(parts) == 2:
|
||||
return int(parts[0]) * 60 + int(parts[1])
|
||||
elif len(parts) == 3:
|
||||
return int(parts[0]) * 3600 + int(parts[1]) * 60 + int(parts[2])
|
||||
except (ValueError, IndexError):
|
||||
return None
|
||||
elif isinstance(duration, (int, float)):
|
||||
return int(duration)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user