Update obsidian-kb skill and add find-skills
- obsidian-kb: Add OCR processors (easyocr, tesseract) - obsidian-kb: Fix subtitle detection with test files - obsidian-kb: Add cookie verification script - Add find-skills skill for discovering capabilities - Add video processing scripts - Update clawhub lock file
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
测试修复后的 B 站字幕提取
|
||||
"""
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 添加项目路径
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'skills', 'obsidian-kb'))
|
||||
|
||||
from src.extractors.bilibili_extractor import BilibiliExtractor
|
||||
|
||||
async def test_extract():
|
||||
"""测试提取器"""
|
||||
# 创建提取器实例
|
||||
extractor = BilibiliExtractor()
|
||||
|
||||
# 测试视频
|
||||
bvid = "BV1yx411s7Jq"
|
||||
|
||||
print(f"测试视频: {bvid}")
|
||||
print("=" * 60)
|
||||
|
||||
try:
|
||||
# 直接调用异步方法
|
||||
result = await extractor._extract_async(bvid)
|
||||
|
||||
print("\n✅ 提取成功!\n")
|
||||
print("=" * 60)
|
||||
print("元数据:")
|
||||
print("=" * 60)
|
||||
for key, value in result['metadata'].items():
|
||||
print(f" {key}: {value}")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("字幕:")
|
||||
print("=" * 60)
|
||||
subtitle = result['subtitle']
|
||||
if subtitle:
|
||||
lines = subtitle.split('\n')
|
||||
print(f"共 {len(lines)} 条字幕")
|
||||
print("\n前 10 条字幕:")
|
||||
print("\n".join(lines[:10]))
|
||||
if len(lines) > 10:
|
||||
print(f"\n...(还有 {len(lines) - 10} 条)")
|
||||
else:
|
||||
print(" 该视频没有字幕")
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n❌ 测试失败: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(test_extract())
|
||||
Reference in New Issue
Block a user