mirror of
https://github.com/saveweb/biliarchiver.git
synced 2024-09-19 19:15:27 -07:00
如 metadata 中出现 \b
XML 非法控制字符,上传 IA 前删掉它
This commit is contained in:
parent
2277731f38
commit
da54602a58
@ -153,6 +153,15 @@ def _upload_bvid(bvid: str, *, update_existing: bool = False, collection: str):
|
||||
'originalurl': f'https://www.bilibili.com/video/{bvid}/?p={pid}',
|
||||
'scanner': f'biliarchiver v{BILI_ARCHIVER_VERSION} (dev)',
|
||||
}
|
||||
|
||||
# XML 中不能有 \b 等特殊控制字符,IA 会拒收。
|
||||
# 先只简单删 \b ,如果以后再发现元数据里出现其它非法字符,再说。
|
||||
_md_str = json.dumps(md, ensure_ascii=False)
|
||||
if "\\b" in _md_str:
|
||||
print("WARNING: \\b in metadata, removing it")
|
||||
md = json.loads(_md_str.replace("\\b", ""))
|
||||
del(_md_str)
|
||||
|
||||
print(filedict)
|
||||
print(md)
|
||||
|
||||
|
@ -39,7 +39,7 @@ def parse_args():
|
||||
help='不检查 IA 上是否已存在对应 BVID 的 item ,直接开始下载')
|
||||
parser.add_argument('--fb', '--from-browser', dest='from_browser', type=str, help='从指定浏览器导入 cookies (否则导入 config.json 中的 cookies_file) [default: None]', default=None)
|
||||
parser.add_argument('--min-free-space-gb', dest='min_free_space_gb', type=int, help='最小剩余空间 (GB),用超退出 [default: 10]', default=10)
|
||||
|
||||
|
||||
args = Args(**vars(parser.parse_args()))
|
||||
|
||||
return args
|
||||
|
Loading…
Reference in New Issue
Block a user