refactor: 移除bilibili_extractor插件,改用obsidian-kb

- 删除 bilibili_extractor.py 及相关文档和配置
- 删除 bilibili_venv 虚拟环境
- 删除测试脚本和生成的B站笔记
- 以后使用 skills/obsidian-kb 提供的B站提取功能
This commit is contained in:
OpenClaw Agent
2026-02-07 14:44:58 +08:00
parent f15c494d37
commit 8163c37e83
13 changed files with 612 additions and 1003 deletions
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
测试 B站提取器 API 方法
"""
import sys
import json
import asyncio
from pathlib import Path
# 添加 src 目录到路径
sys.path.insert(0, str(Path(__file__).parent / 'skills' / 'obsidian-kb' / 'src'))
from playwright.async_api import async_playwright
async def test_api_extraction():
"""测试 API 提取方法"""
print("开始测试 B站 API 提取...")
playwright = await async_playwright().start()
print("Playwright 启动成功")
browser = await playwright.chromium.launch(
headless=True,
args=['--no-sandbox', '--disable-setuid-sandbox']
)
print("浏览器启动成功")
page = await browser.new_page()
print("页面创建成功")
# 提取视频信息
api_url = "https://api.bilibili.com/x/web-interface/view"
bvid = "BV1MnFNz5EDL"
print(f"\n调用 API: {api_url}?bvid={bvid}")
response = await page.request.get(api_url, params={'bvid': bvid})
print(f"API 响应状态: {response.status}")
if response.ok:
data = await response.json()
if data.get('code') == 0:
video_data = data.get('data', {})
# 解析视频数据
info = {
'title': video_data.get('title', ''),
'bvid': video_data.get('bvid', ''),
'aid': video_data.get('aid', ''),
'author': video_data.get('owner', {}).get('name', ''),
'duration': video_data.get('duration', 0),
'desc': video_data.get('desc', ''),
}
# 统计数据
stat = video_data.get('stat', {})
stats = {
'view': stat.get('view', 0),
'like': stat.get('like', 0),
'coin': stat.get('coin', 0),
'favorite': stat.get('favorite', 0),
}
print("\n✅ 提取成功!\n")
print("视频信息:")
print(json.dumps(info, indent=2, ensure_ascii=False))
print("\n统计数据:")
print(json.dumps(stats, indent=2, ensure_ascii=False))
else:
print(f"API 返回错误: {data.get('message', '未知错误')}")
else:
print(f"API 请求失败: HTTP {response.status}")
await browser.close()
await playwright.stop()
print("\n测试完成")
if __name__ == '__main__':
asyncio.run(test_api_extraction())