fix(bilibili): correct metadata and filename in archive
PR Test / lint (pull_request) Successful in 1s
PR Test / lint (pull_request) Successful in 1s
- Add _normalize_metadata() to flatten nested metadata structure
- Fix generate_frontmatter() to use correct metadata fields
- Change _sanitize_filename() to return standardized "bilibili_{bvid}" format
Fixes: analysis.md frontmatter showing "未命名"/0/"未知" instead of actual values
Fixes: audio filename using video title instead of platform_bvid format
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -461,26 +461,17 @@ class BilibiliAdapter(PlatformAdapter):
|
||||
return "video"
|
||||
|
||||
def _sanitize_filename(self, title: str, bvid: str) -> str:
|
||||
"""Sanitize title for use as filename.
|
||||
"""Generate standardized filename for video download.
|
||||
|
||||
Args:
|
||||
title: Video title
|
||||
bvid: Video BV号 for fallback
|
||||
title: Video title (unused, kept for API compatibility)
|
||||
bvid: Video BV号
|
||||
|
||||
Returns:
|
||||
Safe filename string
|
||||
Standardized filename in format "bilibili_{bvid}"
|
||||
"""
|
||||
# Keep alphanumeric, spaces, and common Chinese-safe chars
|
||||
safe_title = "".join(
|
||||
c for c in title
|
||||
if c.isalnum() or c in (' ', '-', '_', '丨', '|')
|
||||
).strip()[:50]
|
||||
|
||||
# Use bvid if title is empty
|
||||
if not safe_title:
|
||||
safe_title = f"video_{bvid}"
|
||||
|
||||
return safe_title
|
||||
# Use standardized naming convention: platform_bvid
|
||||
return f"bilibili_{bvid}"
|
||||
|
||||
def _create_cookie_file(self, cookie: str) -> str:
|
||||
"""Create Netscape format cookie file for yt-dlp.
|
||||
|
||||
Reference in New Issue
Block a user